Java 中的長整數型別十六進位制文字
型別為長整數的十六進位制文字表示為 −
long hexLong = 0XABL;
對於十六進位制數字,0x 或 0X 要放在數字的開頭。
注意 − 在十六進位制數字中,數字 10 至 15 由 a 到 f (A 到 F) 表示。
示例
public class Demo { public static void main(String []args) { long hexLong = 0XABL; System.out.println("Hexadecimal literal of type long: "+hexLong); } }
輸出
Hexadecimal literal of type long:171
廣告