String (@NotNull Number value, @NotNull Class targetClass) { if (targetClass.equals(Byte.class) || targetClass.equals(byte.class)) { return Byte.toString((Byte)value); } if (targetClass.equals(Short.class) || targetClass.equals(short.class)) { return Short.toString((Short)value); } if (targetClass.equals(Integer.class) || targetClass.equals(int.class)) { return Integer.toString((Integer)value); } if (targetClass.equals(Long.class) || targetClass.equals(long.class)) { return Long.toString((Long)value); } if (targetClass.equals(BigInteger.class)) { return value.toString(); } if (targetClass.equals(Float.class) || targetClass.equals(float.class)) { return Float.toString((Float)value); } if (targetClass.equals(Double.class) || targetClass.equals(double.class)) { return Double.toString((Double)value); } if (targetClass.equals(BigDecimal.class) || targetClass.equals(Number.class)) { return ((BigDecimal)value).toPlainString(); } return null; }