(int i, int minWidth)
| 224 | } |
| 225 | |
| 226 | public static String intToHexString(int i, int minWidth) { |
| 227 | int bufLen = 8; // Max number of hex digits in an int |
| 228 | char[] buf = new char[bufLen]; |
| 229 | int cursor = bufLen; |
| 230 | |
| 231 | char[] digits = DIGITS; |
| 232 | do { |
| 233 | buf[--cursor] = digits[i & 0xf]; |
| 234 | } while ((i >>>= 4) != 0 || (bufLen - cursor < minWidth)); |
| 235 | |
| 236 | return new String(buf, cursor, bufLen - cursor); |
| 237 | } |
| 238 | |
| 239 | public static String intToOctalString(int i) { |
| 240 | int bufLen = 11; // Max number of octal digits in an int |