How to convert from binary to decimal in java? -


i trying write code in java takes binary string user, using arrays(?), makes base 10 integer. friend trying me wrote this, there no variable "c" , not have idea tried do.

 //binary conversion  system.out.println("enter value in binary convert decimal");  int binary =   int decimalvalue = integer.parseint(c, 2); 

before this, had skeleton code , declared keyboard scanner, assume

int binary 

is followed

kbreader.nextint(); 

any help?

you can read input string using scanner.next(); use integer parse method said take input string , wanted radix in case =2


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -