Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > BOOK: Beginning Java 2, JDK 5 Edition
|
BOOK: Beginning Java 2, JDK 5 Edition
This is the forum to discuss the Wrox book Ivor Horton's Beginning Java 2, JDK 5 Edition by Ivor Horton; ISBN: 9780764568749
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2, JDK 5 Edition section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 3rd, 2005, 08:50 PM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default losing the leading zero in binary values

Hi all,

This is my first posting, think it’s great to have a community based around a book - really helpful. I’m currently creating some examples of bitwise operations from p64, and I’ve just noticed that I’m losing the leadnig zero of a binary value ( e.g.

decimal 1 (expecting to see bin of 0001) is manifesting as 1
decimal 16 (expecting to see bin of 00010000) is manifesting as 10000

below is an example if you want to compile it
_______________________________

import static java.lang.Integer.*;
public class BitExample {
  public static void main(String[] args) {
    System.out.println(
           toBinaryString(0x1) + '\n' +
           toBinaryString(0x16) + '\n' +
           toBinaryString(0x6a) + '\n' +
           toBinaryString(0x80)
        );
  }
}

_______________________________

I can see I’m missing something, but not sure what. Can you help?
Many Thanks
Giles
 
Old September 20th, 2005, 03:53 PM
Registered User
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry, I have no answer for you.
But I see that in six weeks nobody answered you,
and as I just did my first post myself yesterday
that tells me I should not hope to get an answer
here. I guess you are not so enthusiastic anymore
about having a mailing list. Well, probably you don't
even see this message anymore....

 
Old September 22nd, 2005, 11:41 AM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

Yeah I'm a little surprised to get a response, but thanks! I got a speedy reply by using the various java forums run by sun. BTW, you can opt to 'watch' a posting & be emailed when (erm if) you get a reply.

Don't get me wrong ... I think the idea of running a forum focused around a book is FANTASTIC! ... but in reality you need (1) a lot of readers involved to make it worthwhile and (2) people considerably more experianced to answer the postings. Personally I'd be really up for more of this, but I fear I'm in a minority!!

Best
Giles:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I keep leading and trailing whitespaces? 2BOrNot2B XSLT 2 October 31st, 2008 11:35 AM
Leading and Kerning of Text vijay.bhaskar General .NET 0 September 26th, 2007 12:06 AM
Variables losing their values jrensink78 ASP.NET 1.0 and 1.1 Basics 3 April 13th, 2006 01:09 PM
Displaying leading whitespace djmarquette XSLT 2 January 26th, 2005 10:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.