Java中的积分转换字符
积分转换字符包括以下内容。
| 字符 | 描述 |
|---|---|
| %d | 整数 |
| %o | 八进制 |
| %x | 十六进制 |
| %X | 十六进制 |
示例
public class Demo {
public static void main(String[] args) throws Exception {
System.out.printf( "Integer: %d
", 889 );
System.out.printf( "Negative Integer: %d
", -78 );
System.out.printf( "Octal: %o
", 677 );
System.out.printf( "Hexadecimal: %x
", 56 );
System.out.printf( "Hexadecimal: %X
", 99 );
}
}输出
Integer: 889 Negative Integer: -78 Octal: 1245 Hexadecimal: 38 Hexadecimal: 63
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C编程
C++
C#
MongoDB
MySQL
Javascript
PHP