📄 typechange.java
字号:
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: TypeChange.java
package com.gamvan.tools;
import java.util.HashMap;
public class TypeChange
{
public TypeChange()
{
}
public static HashMap objToHashMap(Object o)
{
try
{
return (HashMap)o;
}
catch(Exception e)
{
return null;
}
}
public static int objToInt(Object o)
{
int i = 0;
if(o == null)
i = 0;
else
try
{
Integer it = (Integer)o;
i = it.intValue();
}
catch(Exception e)
{
i = 0;
}
return i;
}
public static double objToDouble(Object o)
{
double d = 0.0D;
if(o == null)
d = 0.0D;
else
try
{
Double du = (Double)o;
d = du.doubleValue();
}
catch(Exception e)
{
d = 0.0D;
}
return d;
}
public static short objToShort(Object o)
{
short s = 0;
if(o == null)
s = 0;
else
try
{
Short du = (Short)o;
s = du.shortValue();
}
catch(Exception e)
{
s = 0;
}
return s;
}
public static String objOfString(Object o)
{
String str = "";
if(o == null)
str = "";
else
str = String.valueOf(o);
return str;
}
public static String nullOfString(String str)
{
if(str == null)
str = "";
return str;
}
public static byte stringToByte(String str)
{
byte b = 0;
if(str != null)
try
{
b = Byte.parseByte(str);
}
catch(Exception exception) { }
return b;
}
public static boolean stringToBoolean(String str)
{
if(str == null)
return false;
if(str.equals("1"))
return true;
if(str.equals("0"))
return false;
try
{
return Boolean.parseBoolean(str);
}
catch(Exception e)
{
return false;
}
}
public static int stringToInt(String str)
{
int i = 0;
if(str != null)
try
{
i = Integer.parseInt(str.trim());
}
catch(Exception e)
{
i = 0;
}
else
i = 0;
return i;
}
public static short stringToShort(String str)
{
short i = 0;
if(str != null)
try
{
i = Short.parseShort(str.trim());
}
catch(Exception e)
{
i = 0;
}
else
i = 0;
return i;
}
public static double stringToDouble(String str)
{
double i = 0.0D;
if(str != null)
try
{
i = Double.parseDouble(str.trim());
}
catch(Exception e)
{
i = 0.0D;
}
else
i = 0.0D;
return i;
}
public static String intToString(int i)
{
String str = "";
try
{
str = String.valueOf(i);
}
catch(Exception e)
{
str = "";
}
return str;
}
public static long doubleToLong(double d)
{
long lo = 0L;
try
{
lo = Long.parseLong(String.valueOf(d).substring(0, String.valueOf(d).lastIndexOf(".")));
}
catch(Exception e)
{
lo = 0L;
}
return lo;
}
public static int doubleToInt(double d)
{
int i = 0;
try
{
i = Integer.parseInt(String.valueOf(d).substring(0, String.valueOf(d).lastIndexOf(".")));
}
catch(Exception e)
{
i = 0;
}
return i;
}
public static double longToDouble(long d)
{
double lo = 0.0D;
try
{
lo = Double.parseDouble(String.valueOf(d));
}
catch(Exception e)
{
lo = 0.0D;
}
return lo;
}
public static int longToInt(long d)
{
int lo = 0;
try
{
lo = Integer.parseInt(String.valueOf(d));
}
catch(Exception e)
{
lo = 0;
}
return lo;
}
public static long stringToLong(String str)
{
Long li = new Long(0L);
try
{
li = Long.valueOf(str);
}
catch(Exception exception) { }
return li.longValue();
}
public static String longToString(long li)
{
String str = "";
try
{
str = String.valueOf(li);
}
catch(Exception exception) { }
return str;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -