List of utility methods to do Integer to
byte[] | intToNumericFormat(int src) Converts the internal integer representation of an IPv4 into a binary address. byte[] addr = new byte[INADDRSZ]; addr[0] = (byte) ((src >>> 24) & 0xFF); addr[1] = (byte) ((src >>> 16) & 0xFF); addr[2] = (byte) ((src >>> 8) & 0xFF); addr[3] = (byte) (src & 0xFF); return addr; |
String | intToOctal(int value) int To Octal String octString = Integer.toOctalString(value);
return octString;
|
String | IntToOctString(final int value) Int To Oct String final String string = Integer.toString(value, 8).toUpperCase(); if (string.charAt(0) == '-') { return "-0" + string.substring(1, string.length()); } else { return "0" + string; |
byte[] | intToOneByte(int i) int To One Byte byte[] b = new byte[1]; b[0] = (byte) (i & 0xff); return b; |
byte | intToOneByte(int value) int To One Byte if ((value < 0) || (value > MAX_8BITS)) throw new IllegalArgumentException(String.format(ERR_VALUE_OOB, value)); return (byte) (value & 0xFF); |
byte[] | intToOneByteArray(int number) Returns the int as a byte array with just one entry. return new byte[] { intToByte(number) }; |
char | IntToPackage(int pack) get an int into char depending on the package it represent char iPack; pack = pack + 65; iPack = (char) pack; if (pack >= 65 && pack <= 90) return iPack; else return '#'; |
String | intToPaddedString(int value, int pad) int To Padded String StringBuilder sb = new StringBuilder(); sb.append(value); int padding = pad - sb.length(); if (padding > 0) { sb.insert(0, PADDING.subSequence(0, padding)); return sb.toString(); |
String | intToPercent(int value) int To Percent StringBuilder buffer = new StringBuilder(); int highValue = value / 100; int lowValue = value % 100; buffer.append(highValue).append('.'); if (lowValue < 10) buffer.append('0'); buffer.append(lowValue); return buffer.toString(); ... |
String | intToPlusMin(int i) int To Plus Min switch (i) { case 0: return "\u00A74-2"; case 1: return "\u00A74-1"; case 2: return "\u00A770"; case 3: ... |