Demo:
public class CoinNumText { public static void main(String[] args) { /** 1. 二进制文本 **/ int xBeforeJava7 = Integer.parseInt("11001100", 2); int xJava7 = 0b11001100; /** 2. 数字中的下划线 **/ long anotherLong = 2_147_483_648L; int bitPattern = 0b0001_1100__0011_0111__0010_1011__1010_0011; /** print **/ System.out.println(xBeforeJava7); System.out.println(xJava7); System.out.println(anotherLong); System.out.println(bitPattern); } }
Ran As Java Application:
204 204 2147483648 473377699