return Long.valueOf(longValue);
return new Long(longValue);
    private Object convert(Object source, Class targetClass)    {        if (source == null)        {            return null;        }                Class sourceClass  = source.getClass();        if (sourceClass.equals(targetClass))        {            return source;        }        if (targetClass.equals(String.class))        {            return source.toString();        }        long    longValue    = 0;        double  doubleValue  = 0;        boolean toShort      = false;        boolean toInteger    = false;        boolean toLong       = false;        boolean toFloat      = false;        if (sourceClass.equals(Byte.class))        {            longValue   = ((Byte)source).longValue();            doubleValue = longValue;            toShort     = true;            toInteger   = true;            toLong      = true;            toFloat     = true;        }        else if (sourceClass.equals(Short.class))        {            longValue   = ((Short)source).longValue();            doubleValue = longValue;            toShort     = true;            toInteger   = true;            toLong      = true;            toFloat     = true;        }        else if (sourceClass.equals(Integer.class))        {            longValue   = ((Integer)source).longValue();            doubleValue = longValue;            toShort     = (longValue >= (long)Short.MIN_VALUE) && (longValue <= (long)Short.MAX_VALUE);            toInteger   = true;            toLong      = true;            toFloat     = true;        }        else if (sourceClass.equals(Long.class))        {            longValue   = ((Long)source).longValue();            doubleValue = longValue;            toShort     = (longValue >= (long)Short.MIN_VALUE) && (longValue <= (long)Short.MAX_VALUE);            toInteger   = (longValue >= (long)Integer.MIN_VALUE) && (longValue <= (long)Integer.MAX_VALUE);            toLong      = true;            toFloat     = true;        }        else if (sourceClass.equals(Float.class))        {            doubleValue = ((Float)source).doubleValue();            toFloat     = true;        }        else if (sourceClass.equals(Double.class))        {            doubleValue = ((Double)source).doubleValue();            toFloat     = (doubleValue >= (double)Float.MIN_VALUE) && (doubleValue <= (double)Float.MAX_VALUE);        }        else        {            throw new IllegalArgumentException("Cannot convert from "+sourceClass.getName()+" to "+targetClass.getName());        }        if (targetClass.equals(Short.class))        {            if (toShort)            {                return Short.valueOf((short)longValue);            }        }        else if (targetClass.equals(Integer.class))        {            if (toInteger)            {                return Integer.valueOf((int)longValue);            }        }        else if (targetClass.equals(Long.class))        {            if (toLong)            {                return Long.valueOf(longValue);            }        }        else if (targetClass.equals(Float.class))        {            if (toFloat)            {                return Float.valueOf((float)doubleValue);            }        }        else if (targetClass.equals(Double.class))        {            return Double.valueOf(doubleValue);        }        else if (targetClass.equals(BigDecimal.class))        {            return (toLong ? new BigDecimal(longValue) : new BigDecimal(doubleValue));        }        throw new IllegalArgumentException("Cannot convert from "+sourceClass.getName()+" to "+targetClass.getName());    }