code: private static boolean isBigDecimal( Number n ) {
        if( n instanceof BigDecimal ){
           return true;
        }
        try{
           new BigDecimal( String.valueOf( n ) );
           return true;
        }catch( NumberFormatException e ){
           return false;
        }
     }
docs: Finds out if n represents a BigInteger
  
  @return true if n is instanceOf BigInteger or the literal value can be
  evaluated as a BigInteger