Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to work with other base numbers in java?

Tags:

java

int

Guys if the int c=10001; which is a binary value.If i want to process it like multiplying it by 10 how to do that?

like image 642
professionalcoder2010 Avatar asked May 18 '10 18:05

professionalcoder2010


1 Answers

If I understand you correctly you want to do this: Integer.parseInt("10001", 2), which will give you 17.
Integer.toString also accepts radix as second argument.

Doc: Integer.parseInt(String s, int radix)

like image 183
Nikita Rybak Avatar answered Oct 21 '22 03:10

Nikita Rybak