Wednesday, 28 September 2016

How to convert a binary to integer and vice versa ?


int decimalValue = Integer.parseInt(strNum, 2);    // Binary to Decimal
String binaryValue = Integer.toString(num, 2)   // Decimal to Binary






Use 8 for Octal and 16 for Hexadecimal numbers.