| 879 | } |
| 880 | |
| 881 | private static int toInt(Object o) { |
| 882 | if (o instanceof Integer) return (Integer) o; |
| 883 | if (o instanceof Long) return ((Long) o).intValue(); |
| 884 | if (o instanceof Double) return ((Double) o).intValue(); |
| 885 | if (o instanceof Float) return ((Float) o).intValue(); |
| 886 | if (o instanceof BigDecimal) return ((BigDecimal) o).intValue(); |
| 887 | if (o instanceof String) return Integer.parseInt((String) o); |
| 888 | return Integer.parseInt(String.valueOf(o)); |
| 889 | } |
| 890 | |
| 891 | private static double toDouble(Object o) { |
| 892 | if (o instanceof Double) return (Double) o; |