View Single Post
  #3 (permalink)  
Old 11-22-2009, 05:20 PM
Arnold Arnold is offline
Member
 
Join Date: Oct 2009
Location: Rotterdam
Posts: 39
Rep Power: 0
Arnold is on a distinguished road
Exclamation
Originally Posted by JosAH View Post
Have a look at the Short or Integer classes; both can parse a String as if it were an integer number in (almost) any radix and they can produce a String representing a short (or int) in (almost) any radix; you have to get rid of the prefix 0b or 0x before the parsing but those prefixes tell you wich radix to use.

kind regards,

Jos
I believe he said he could not use the Integer class. Otherwise he could do something like this:
Code:
int i = Interger.parseInt("0110011011100110", 2);
What he needs is a static field with powers of 2, and the charAt() method.
Reply With Quote