Commits
md_5 authored fb96a1afa92
94 94 | return ((Number) object).byteValue(); |
95 95 | } |
96 96 | |
97 97 | try { |
98 98 | return Byte.valueOf(object.toString()); |
99 99 | } catch (NumberFormatException e) { |
100 100 | } catch (NullPointerException e) { |
101 101 | } |
102 102 | return 0; |
103 103 | } |
104 + | |
105 + | public static void checkFinite(double d, String message) { |
106 + | if (Double.isNaN(d) || Double.isInfinite(d)) { |
107 + | throw new IllegalArgumentException(message); |
108 + | } |
109 + | } |
110 + | |
111 + | public static void checkFinite(float d, String message) { |
112 + | if (Float.isNaN(d) || Float.isInfinite(d)) { |
113 + | throw new IllegalArgumentException(message); |
114 + | } |
115 + | } |
104 116 | } |