Here you can find the source of getFieldSize(Class clazz)
public static int getFieldSize(Class clazz)
//package com.java2s; import java.util.IdentityHashMap; import java.util.Map; public class Main { private static final Map primitiveSizes = new IdentityHashMap() { {//from ww w . j av a2s . c o m put(boolean.class, new Integer(1)); put(byte.class, new Integer(1)); put(char.class, new Integer(2)); put(short.class, new Integer(2)); put(int.class, new Integer(4)); put(float.class, new Integer(4)); put(double.class, new Integer(8)); put(long.class, new Integer(8)); } }; public static int getFieldSize(Class clazz) { Integer i = (Integer) primitiveSizes.get(clazz); return i != null ? i.intValue() : getPointerSize(); } public static int getPointerSize() { return 4; } }