Online Java Compiler By
JavaTpoint.com
import java.util.Scanner; public class IntegerValueOfExample4 { public static void main(String[] args)throws NumberFormatException { //Input desired value from the console System.out.print("Enter Desired Value: "); Scanner scan = new Scanner(System.in); String strValue = scan.nextLine(); //Input base number from the console System.out.print("Enter Base Number: "); int radix = scan.nextInt(); scan.close(); // print the output in decimal format System.out.println("Output Value: " +Integer.valueOf(strValue, radix)); } }
Output