File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Question on Integer.toBinaryString (maybe) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question on Integer.toBinaryString (maybe)" Watch "Question on Integer.toBinaryString (maybe)" New topic
Author

Question on Integer.toBinaryString (maybe)

ravel chen
Greenhorn

Joined: Mar 03, 2004
Posts: 3
Here is the code,which I wrote to figure out sign(and unsign) concept.

After compiling
I got
11110111111100011101011111001011
11111011111110001110101111100101
11111101111111000111010111110010
11111110111111100011101011111001
11111111011111110001110101111100
11111111101111111000111010111110
11111111110111111100011101011111
11111111111011111110001110101111
11111111111101111111000111010111
11111111111110111111100011101011
11111111111111011111110001110101
11111111111111101111111000111010
11111111111111110111111100011101
11111111111111111011111110001110
11111111111111111101111111000111
11111111111111111110111111100011
11111111111111111111011111110001
11111111111111111111101111111000
11111111111111111111110111111100
11111111111111111111111011111110
11111111111111111111111101111111
11111111111111111111111110111111
11111111111111111111111111011111
11111111111111111111111111101111
11111111111111111111111111110111
11111111111111111111111111111011
11111111111111111111111111111101
11111111111111111111111111111110
11111111111111111111111111111111
11111111111111111111111111111111
11111111111111111111111111111111
11111111111111111111111111111111
11110111111100011101011111001011

My question is
Is there any way that I can see the 33 results directly
in integer form by adding some words?
Simply speaking,how do I translate some strings like
(11111011111110001110101111100101) to integer?
Thanks for your answer.
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ March 15, 2004: Message edited by: Dirk Schreckmann ]
Jean-Francois Briere
Ranch Hand

Joined: Mar 03, 2004
Posts: 101
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522
You can try what Jean suggested or you can try this

If you need to obtain other bases, consider changing 2 to 8 for Octal or 16 for Hex ...etc.
[ March 15, 2004: Message edited by: Vicken Karaoghlanian ]

- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. <br />- What truth? <br />- That there is no spoon!!!
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, ravel chen!
I've very happy that some fellow ranchers have already helped to point you in the right direction for solving your problem. I'm posting just to suggest a simple tip to help improve communications in these forums.
When posting code, please be sure to surround the code with the [code] and [/code] UBB Tags. This will help to preserve the formatting of the code, thus making it easier to read and understand.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question on Integer.toBinaryString (maybe)