Example usage for java.lang Integer parseInt

List of usage examples for java.lang Integer parseInt

Introduction

In this page you can find the example usage for java.lang Integer parseInt.

Prototype

public static int parseInt(String s, int radix) throws NumberFormatException 

Source Link

Document

Parses the string argument as a signed integer in the radix specified by the second argument.

Usage

From source file:Main.java

public static void main(String[] args) {
    System.out.println(Integer.parseInt("111000", 2));
}

From source file:Main.java

public static void main(String[] args) {
    System.out.println(Integer.parseInt("33", 8));
}

From source file:Main.java

public static void main(String[] args) {
    System.out.println(Integer.parseInt("20", 16));
}

From source file:Main.java

public static void main(String[] args) {

    System.out.println(Integer.parseInt("010", 8));

}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int i = Integer.parseInt("1000", 8);
    String s = Integer.toString(i, 8);
    System.out.println(s);// ww w  .ja v a  2s  . c  o m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int i = Integer.parseInt("3ff", 16);
    String s = Integer.toString(i, 16);
    System.out.println(s);/*  w ww .jav a 2  s .  c om*/
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int i = 1023;

    i = Integer.parseInt("1111111111", 2);
    String s = Integer.toString(i, 2);
    System.out.println(s);//from ww w . j av a 2 s. co  m
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    int radix = 32;
    int i = Integer.parseInt("vv", radix);
    String s = Integer.toString(i, radix);

}

From source file:Main.java

public static void main(String[] args) {
    String strOctalNumber = "33";

    int decimalNumber = Integer.parseInt(strOctalNumber, 8);

    System.out.println(decimalNumber);
}

From source file:Main.java

public static void main(String[] args) {
    String strBinaryNumber = "111000";

    int decimalNumber = Integer.parseInt(strBinaryNumber, 2);
    System.out.println(decimalNumber);
}