publicclassChangeInt{ publicstaticvoidmain(String[] args)throws Exception { var cls = Integer.class.getDeclaredClasses()[0]; var cache = cls.getDeclaredField("cache"); cache.setAccessible(true); var arr = cache.get(null); for(int i = 0; i < 256; ++i){ Array.set(arr, i, 0); } Integer i = 111; int pi = 111; Integer ii = Integer.valueOf(111); System.out.printf("i: %d, pi: %d, ii: %d\n", i, pi, ii); } }
var field = Integer.class.getDeclaredField("digits"); field.setAccessible(true); var digits = field.get(null); for(int i = 0; i < Array.getLength(digits); ++i){ Array.set(digits, i, (char)('1' + Math.random() * 10)); } System.out.println(Integer.toString(0x123456, 16));