public static boolean isWrapperInstance(Class type,Object instance){
  if (!type.isPrimitive())   throw new IllegalArgumentException("Input type must be a primitive");
  if (int.class == type && instance instanceof Integer) {
    return true;
  }
 else   if (long.class == type && instance instanceof Long) {
    return true;
  }
 else   if (float.class == type && instance instanceof Float) {
    return true;
  }
 else   if (double.class == type && instance instanceof Double) {
    return true;
  }
 else   if (boolean.class == type && instance instanceof Boolean) {
    return true;
  }
 else   if (short.class == type && instance instanceof Short) {
    return true;
  }
 else   if (byte.class == type && instance instanceof Byte) {
    return true;
  }
 else   if (char.class == type && instance instanceof Character) {
    return true;
  }
 else {
    return false;
  }
}

public static boolean isWrapperInstance ( Class type , Object instance ) { if ( ! type . isPrimitive ( ) ) throw new IllegalArgumentException ( "Input type must be a primitive" ) ; if ( int . class == type && instance instanceof Integer ) { return true ; } else if ( long . class == type && instance instanceof Long ) { return true ; } else if ( float . class == type && instance instanceof Float ) { return true ; } else if ( double . class == type && instance instanceof Double ) { return true ; } else if ( boolean . class == type && instance instanceof Boolean ) { return true ; } else if ( short . class == type && instance instanceof Short ) { return true ; } else if ( byte . class == type && instance instanceof Byte ) { return true ; } else if ( char . class == type && instance instanceof Character ) { return true ; } else { return false ; } }
indicates if an object is an instance of a wrapper class for a given primitive type .
