Results 1 to 2 of 2
- 11-01-2011, 04:03 PM #1
Member
- Join Date
- Nov 2011
- Posts
- 2
- Rep Power
- 0
Convert integer to binary then each binary character to boolean
Hey,
I need to convert an int, say 90, to a binary number (1011010), then i need to separate each digit and save it as a true or false boolean.
(true, false, true, true, false, true, false).
so far :
String a;
a = Integer.toBinaryString(int b);
Any help is appreciated.
- 11-01-2011, 05:35 PM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Re: Convert integer to binary then each binary character to boolean
all roads lead to Rome... do you have no idea?
1. the boolean array must have the same size as the string -> boolean[] array = new boolean[a.length()];
2. the string class has useful methods, like charAt(index) or toCharArray() to get each digit
3. if the digit is == '1' -> save true in your boolean array on position 'index'
or or or ...
Similar Threads
-
convert integer to binary
By leepikamukharji in forum New To JavaReplies: 2Last Post: 04-30-2011, 04:19 AM -
convert interger value to binary value
By ahmed80 in forum New To JavaReplies: 6Last Post: 01-21-2011, 11:26 AM -
Help with Binary recursive method to find the largest integer
By flyingcurry in forum New To JavaReplies: 12Last Post: 10-31-2010, 06:14 PM -
Convert Decimal To Binary
By aspire007 in forum New To JavaReplies: 8Last Post: 08-06-2010, 07:32 AM -
convert binary to images
By fiqueudrue in forum New To JavaReplies: 3Last Post: 02-12-2009, 09:16 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks