Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

public class Main {
    public static void main(String[] args) {
        String str = "01111111";
        int radix = 2;

        // Creates an Integer object from the string
        Integer intObject = Integer.valueOf(str, radix);

        // Extracts the int value from the string
        int intValue = Integer.parseInt(str, 2);

        System.out.println("str = " + str);
        System.out.println("intObject = " + intObject);
        System.out.println("intValue = " + intValue);

    }
}