Java工具類 NumberUtils 對整型數字的引用
package com.example.core.mydemo.javaDemo; public class IntegerTest { public static void main(String[] args) { Integer one = null; if (org.apache.commons.lang3.math.NumberUtils.INTEGER_ONE.equals(one)) { System.out.println("111"); } else if (org.apache.commons.lang3.math.NumberUtils.INTEGER_TWO.equals(one)) { System.out.println("222"); } } }