Results 1 to 2 of 2
Thread: Convert String to Binary
- 09-01-2010, 07:54 AM #1
Member
- Join Date
- May 2010
- Posts
- 14
- Rep Power
- 0
Convert String to Binary
i try convert String to biner but i think my answer is not correct, because i'm input number 1010 and 1010 is biner number so why result is not 1010.Java Code:public class Convert { public static void main(String[] args) { System.out.println(Integer.parseInt("1010",2)); } }
Thanks.
- 09-01-2010, 08:25 AM #2
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,423
- Blog Entries
- 7
- Rep Power
- 17
"1010" is the String representation of a number in binary representation; it is 10 decimal which is the default format if you print it. The Integer class has a method that generates String representations in other radixes (which is kind of useless here because you already have the binary String representation to start with).
kind regards,
Jos
Similar Threads
-
Convert Decimal To Binary
By aspire007 in forum New To JavaReplies: 8Last Post: 08-06-2010, 07:32 AM -
how to convert decimal value into 8-bit binary value
By tOpach in forum New To JavaReplies: 4Last Post: 10-26-2009, 10:17 PM -
Convert binary into decimal
By WarmRegards in forum New To JavaReplies: 8Last Post: 10-18-2009, 02:32 PM -
convert binary to images
By fiqueudrue in forum New To JavaReplies: 3Last Post: 02-12-2009, 09:16 AM -
Use recursion to convert binary to...
By coco in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 07:46 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks