Problem description The hexadecimal number is a representation of an integer that is often used in programming. It has a 0,1,2,3,4,5,6,7,8,9,a,b,c,d,e,f total of 16 symbols, representing 0 to 15 of the decimal number, respectively. The hexadecimal counting method is full 16 into 1, so the decimal 16 is 10 in hexadecimal, and the decimal 17 is 11 in hexadecimal, and so on, and the decimal 30 in hexadecimal is 1 E.
Gives a nonnegative integer, which is expressed as a 16-in form. The input format input contains a non-negative integer A that represents the number to convert. 0<=a<=2147483647 output format output of this integer in the 16-example Input 30 sample output 1E
Import Java.util.Scanner;
public class Main {public
static void Main (string[] args) {
Scanner in = new Scanner (system.in);
Integer n = in.nextint ();
In.close ();
System.out.println (integer.tohexstring (n). toUpperCase ());
}
About the conversion, I do not like this problem, I feel that there is not much significance (but 16 into the octal or more troublesome, there will be the problem), here in the code lazy, Java with the conversion function, so directly written. There is also a sort of problem, I do not intend to write out, because that question is also directly call the Arrays.sort () function, there is no technical content