List of utility methods to do Type Size
int | sizeOfBinary(int maximumNumber) size Of Binary return (Long.toBinaryString((long) maximumNumber) + "").length(); |
int | sizeOfCompactInt(int i) size Of Compact Int i = Math.abs(i); if (i >= 1 << (6 + 7 + 7 + 7)) return 5; else if (i >= 1 << (6 + 7 + 7)) return 4; else if (i >= 1 << (6 + 7)) return 3; else if (i >= 1 << (6)) ... |
int | sizeOfEnumValue(T enumValue) size Of Enum Value return sizeOfString(enumValue.toString());
|
int | sizeOfFloat(float f) size Of Float return Float.floatToIntBits(f) / Byte.SIZE;
|
int | sizeOfInt() size Of Int return 4;
|
int | sizeOfInt(int x) calculate the size of an integer number for (int i = 0;; i++) if (x <= SIZE_TABLE[i]) { return i + 1; |
int | sizeOfInVarInt32(int length) Compute the space needed to encode the length in BER code. if (length < (1 << 7)) { return 1; if (length < (1 << 14)) { return 2; if (length < (1 << 21)) { return 3; ... |
long | sizeOfPrimitive(Object object) size Of Primitive if (object instanceof String) return ((String) object).getBytes().length; for (int i = 0; i < PRIMITIVE_CLASS.length; i++) if (object.getClass() == PRIMITIVE_CLASS[i]) return PRIMITIVE_SIZE[i]; return 0; |
long | sizeOfPrimitiveArray(Object object) size Of Primitive Array long total = 0L; if (object instanceof Byte[]) { for (Byte b : (Byte[]) object) if (b != null) total += 1; else if (object instanceof Short[]) { for (Short s : (Short[]) object) ... |
int | sizeOfTreeMap(int size) size Of Tree Map return TREE_MAP_SIZE + (OBJECT_SIZE + INT_SIZE + POINTER_SIZE * 5) * size;
|