java.lang.Integer.toHexString()%uA0方法返回一个整数参数的字符串表示形式在基数为16的无符号整数,下面的字符作为十六进制数字:0123456789ABCDEF。
声明
以下是java.lang.Integer.toHexString()方法的声明
public static String toHexString(int i)
参数
-
i%uA0-- 这是要转换为字符串的整数。
返回值
此方法返回由十六进制的参数(以16为基数)表示的无符号整型值的字符串表示形式。
异常
-
NA
例子
下面的例子显示java.lang.Integer.toHexString()方法的使用。
package com.yiibai import java.lang.* public class IntegerDemo { public static void main(String[] args) { int i = 170 System.out.println("Number = " + i) /* returns the string representation of the unsigned integer value represented by the argument in hexadecimal (base 16) */ System.out.println("Hex = " + Integer.toHexString(i)) } }
让我们来编译和运行上面的程序,这将产生以下结果:
Number = 170 Hex = aa