I am trying to write code in java that takes a binary string from the user, then using arrays(?), makes it a base 10 integer. My friend trying to help me wrote this, but there is no variable "c" and i do not have any idea what he tried to do.
//Binary Conversion
System.out.println("Enter a value in binary to convert to decimal");
int binary =
int decimalValue = Integer.parseInt(c, 2);
Before this, i already had skeleton code and a declared keyboard scanner, so I assume that
int binary
is followed by
kbReader.nextInt();
Any help?
String c = kbReader.nextLine(). You need aStringto pass toInteger.parseInt.