package com.kingston.jforgame.common.utils;

public final class NumberUtil {
	
	public static byte byteValue(Object object) {
		return byteValue(object, Byte.valueOf("0"));
	}
	
	public static byte byteValue(Object object, byte defaultValue) {
		if (object == null) {
			return defaultValue;
		}
		if (object.getClass() == float.class || object.getClass() == Float.class) {
			return (byte)object;
		}
		try {
			return Byte.valueOf(object.toString());
		}catch(Exception e) {
			return defaultValue;
		}
	}

}
 
@@ -70,18 +70,17 @@
 rUtil %7B%0A
-%09
 %0A
+
 %09public 
@@ -172,10 +172,9 @@
 %0A%09%7D%0A
-%09
 %0A
+
 %09pub
@@ -318,13 +318,12 @@
  == 
-float
+byte
 .cla
@@ -353,13 +353,12 @@
  == 
-Float
+Byte
 .cla
@@ -502,7 +502,1684 @@
 %09%7D%0A%0A
+%09public static short shortValue(Object object) %7B%0A%09%09return shortValue(object, (short)0);%0A%09%7D%0A%0A%09public static short shortValue(Object object, short defaultValue) %7B%0A%09%09if (object == null) %7B%0A%09%09%09return defaultValue;%0A%09%09%7D%0A%09%09if (object.getClass() == short.class %7C%7C object.getClass() == Short.class) %7B%0A%09%09%09return (short)object;%0A%09%09%7D%0A%09%09try %7B%0A%09%09%09return Short.valueOf(object.toString());%0A%09%09%7Dcatch(Exception e) %7B%0A%09%09%09return defaultValue;%0A%09%09%7D%0A%09%7D%0A%0A%09public static int intValue(Object object) %7B%0A%09%09return intValue(object, 0);%0A%09%7D%0A%0A%09public static int intValue(Object object, int defaultValue) %7B%0A%09%09if (object == null) %7B%0A%09%09%09return defaultValue;%0A%09%09%7D%0A%09%09if (object.getClass() == int.class %7C%7C object.getClass() == Integer.class) %7B%0A%09%09%09return (int)object;%0A%09%09%7D%0A%09%09try %7B%0A%09%09%09return Integer.valueOf(object.toString());%0A%09%09%7Dcatch(Exception e) %7B%0A%09%09%09return defaultValue;%0A%09%09%7D%0A%09%7D%0A%0A%09public static long longValue(Object object) %7B%0A%09%09return longValue(object, 0L);%0A%09%7D%0A%0A%09public static long longValue(Object object, long defaultValue) %7B%0A%09%09if (object == null) %7B%0A%09%09%09return defaultValue;%0A%09%09%7D%0A%09%09if (object.getClass() == long.class %7C%7C object.getClass() == Long.class) %7B%0A%09%09%09return (long)object;%0A%09%09%7D%0A%09%09try %7B%0A%09%09%09return Long.valueOf(object.toString());%0A%09%09%7Dcatch(Exception e) %7B%0A%09%09%09return defaultValue;%0A%09%09%7D%0A%09%7D%0A%0A%09public static double doubleValue(Object object) %7B%0A%09%09return doubleValue(object, 0);%0A%09%7D%0A%0A%09public static double doubleValue(Object object, double defaultValue) %7B%0A%09%09if (object == null) %7B%0A%09%09%09return defaultValue;%0A%09%09%7D%0A%09%09if (object.getClass() == double.class %7C%7C object.getClass() == Double.class) %7B%0A%09%09%09return (long)object;%0A%09%09%7D%0A%09%09try %7B%0A%09%09%09return Double.valueOf(object.toString());%0A%09%09%7Dcatch(Exception e) %7B%0A%09%09%09return defaultValue;%0A%09%09%7D%0A%09%7D%0A%0A
 %7D%0A
- 

update NumberUtil