parseInt() Method, parse Binary to int Decimal in java

Java Programming Language / Number Class in java

1122

Program:

 
public class ParseBinary {

   public static void main(String args[]) {

      int b = Integer.parseInt("10110110",2);

      System.out.println(b);
   }
}

/*
parseInt(int i) - This returns an integer, given a string
representation of decimal, binary, octal, or hexadecimal
(radix equals 10, 2, 8, or 16 respectively) numbers as input.

*/

Output:

182
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.