public class DataChange { public static String longto36(Long x) { String[] a = new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}; Long b = x; String nb = ""; while (b != 0) { Long c = b % 36; Long d = b / 36; nb = a[c.intValue()] + nb; b = Math.round(Math.floor(d)); } switch (nb.length() % 6) { case 0: return nb; case 1: return "00000" + nb; case 2: return "0000" + nb; case 3: return "000" + nb; case 4: return "00" + nb; case 5: return "0" + nb; default: return ""; } } }
10进制转36进制,固定6位 方法
猜你喜欢
转载自blog.csdn.net/u013401913/article/details/70763483
今日推荐
周排行