Here you can find the source of numberToString(Object num)
public static String numberToString(Object num)
//package com.java2s; public class Main { public static String numberToString(Object num) { if (num == null) { return null; } else if (num instanceof Integer && (Integer) num > 0) { return Integer.toString((Integer) num); } else if (num instanceof Long && (Long) num > 0) { return Long.toString((Long) num); } else if (num instanceof Float && (Float) num > 0) { return Float.toString((Float) num); } else if (num instanceof Double && (Double) num > 0) { return Double.toString((Double) num); } else {/*from ww w .j a va2s. c o m*/ return ""; } } }