Java Primitive Type Create toPrimitive(Class clazz)

Here you can find the source of toPrimitive(Class clazz)

Description

to Primitive

License

Open Source License

Declaration

public static Class<?> toPrimitive(Class<?> clazz) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static Class<?> toPrimitive(Class<?> clazz) {
        if (clazz == Boolean.class)
            return boolean.class;
        if (clazz == Character.class)
            return char.class;
        if (clazz == Byte.class)
            return byte.class;
        if (clazz == Short.class)
            return short.class;
        if (clazz == Integer.class)
            return int.class;
        if (clazz == Long.class)
            return long.class;
        if (clazz == Float.class)
            return float.class;
        if (clazz == Double.class)
            return double.class;
        if (clazz == Void.class)
            return void.class;
        return clazz;
    }//from   w w  w  .  j a v  a  2  s  .  com
}

Related

  1. toPrimitive(Byte[] bytes)
  2. toPrimitive(Byte[] objectArray)
  3. toPrimitive(Character value)
  4. toPrimitive(Character[] in)
  5. toPrimitive(Class aClass)
  6. toPrimitive(Double[] array)
  7. toPrimitive(Double[] array)
  8. toPrimitive(Double[] doubles)
  9. toPrimitive(Double[] vals)