How to convert a binary String such as
String c = "110010"; // as binary
to the value in decimal in Java? (expected result in the example is 50)
Use Integer.parseInt (see javadoc), that converts your String to int using base two:
Integer.parseInt
String
int
int decimalValue = Integer.parseInt(c, 2);
2.1m questions
2.1m answers
60 comments
57.0k users