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
Post a Comment