Java tutorial
//package com.java2s; public class Main { public static final Class[] primitiveTypes = { Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE, Void.TYPE }; public static final int typeIndex(Class type) /* */ { /* 65 */Class[] list = primitiveTypes; /* 66 */int n = list.length; /* 67 */for (int i = 0; i < n; i++) { /* 68 */if (list[i] == type) /* 69 */return i; /* */} /* 71 */throw new RuntimeException("bad type:" + type.getName()); /* */} }