package com.vci.server.framework.delegate; public class TransformDelegate { /************转化************/ public static String sl(int k,int d) { String x; if (d < k) { if(k==16) x = chang(d); else x=new Integer(d).toString(); } else { int c; int s = 0; int n = d; while (n >= k) { s++; n = n / k; } String [] m = new String[s]; int i = 0; do { c = d / k; if(k==16) m[i++] = chang(d % 16); else m[i++] = new Integer(d%k).toString(); d = c; } while (c >= k); x = chang(d); for (int j = m.length - 1; j >= 0; j--) { x += m[j]; } } return x; } public static String chang(int d) //change函数 { String x; switch (d) { case 10: x = "A"; break; case 11: x = "B"; break; case 12: x = "C"; break; case 13: x = "D"; break; case 14: x = "E"; break; case 15: x = "F"; break; default: x = new Integer(d).toString(); break; } return x; } }