题解 | #进制转换#
进制转换
http://www.nowcoder.com/practice/8f3df50d2b9043208c5eed283d1d4da6
import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); //判断是否输入数据 while(sc.hasNext()){ String num = sc.nextLine(); //截取第二位字符串之后的子字符串 String num1 = num.substring(2); //将字符串转为有符号的十进制整数 int num2 = Integer.parseInt(num1,16); System.out.println(num2); } } }