Blue Bridge cup of java basic exercises from hexadecimal decimal

Basic exercises from hexadecimal decimal

Resource constraints

Time limit: 1.0s Memory Limit: 512.0MB

Problem Description

Input from the keyboard is not more than a positive 8-bit hexadecimal number string, converts it to the positive decimal number.
  NOTE: hexadecimal number 10 to 15 are in uppercase letters A, B, C, D, E, F represents.

Sample input

FFFF

Sample Output

65535

import java.util.Scanner;

public class Main {
public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    String a = in.next();
    System.out.print(Long.valueOf(a,16));
}
}
Published 24 original articles · won praise 2 · Views 192

Guess you like

Origin blog.csdn.net/weixin_44570019/article/details/104515431