Java中的整体转换字符
整数转换字符包括以下内容。
示例
public class Demo {
public static void main(String[] args) throws Exception {
System.out.printf( "Integer: %d\n", 889 );
System.out.printf( "Negative Integer: %d\n", -78 );
System.out.printf( "Octal: %o\n", 677 );
System.out.printf( "Hexadecimal: %x\n", 56 );
System.out.printf( "Hexadecimal: %X\n", 99 );
}
}输出结果
Integer: 889 Negative Integer: -78 Octal: 1245 Hexadecimal: 38 Hexadecimal: 63