Title Description
Write a program that accepts a hexadecimal number and outputs the decimal representation of the value. (Multiple groups input at the same time)
Input description:
Enter a hexadecimal numeric string.
Output description:
Output the decimal string of the value.
Example 1
input
0xA
output
10
public class Mine {
public static void main(String [] args) {
Scanner sc = new Scanner(System.in);
while (sc.hasNext()) {
String num = sc.nextLine();
//去掉前两位的0x
System.out.println(Integer.parseInt(num.substring(2), 16));
}
}
}