public static Class<?> maxType(Class<?>... numericTypes) {
    Preconditions.checkArgument(numericTypes.length >= 2);
    int maxIndex = 0;
    for (Class<?> numericType : numericTypes) {
      int index;
      if (isPrimitive(numericType)) {
        index = sortedPrimitiveClasses.indexOf(numericType);
      } else {
        index = sortedBoxedClasses.indexOf(numericType);
      }
      if (index == -1) {
        throw new IllegalArgumentException(
            String.format("Wrong numericTypes %s", Arrays.toString(numericTypes)));
      }
      maxIndex = Math.max(maxIndex, index);
    }
    return sortedPrimitiveClasses.get(maxIndex);
  }
@Test
  public void testMaxType() {
    assertEquals(TypeUtils.maxType(int.class, long.class), long.class);
    assertEquals(TypeUtils.maxType(long.class, int.class), long.class);
    assertEquals(TypeUtils.maxType(float.class, long.class), long.class);
    assertEquals(TypeUtils.maxType(long.class, float.class), long.class);
    List<Class<?>> classes =
        Arrays.asList(
            void.class,
            boolean.class,
            byte.class,
            char.class,
            short.class,
            int.class,
            float.class,
            long.class,
            double.class);
    for (int i = 0; i < classes.size() - 1; i++) {
      assertEquals(TypeUtils.maxType(classes.get(i), classes.get(i + 1)), classes.get(i + 1));
    }
  }