📄 integer.jad
字号:
// Decompiled by DJ v3.7.7.81 Copyright 2004 Atanas Neshkov Date: 2007-3-10 15:35:33
// Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
// Decompiler options: packimports(3)
// Source File Name: Integer.java
package java.lang;
// Referenced classes of package java.lang:
// Number, String, NumberFormatException, StringBuffer,
// IllegalArgumentException, NullPointerException, Comparable, ThreadLocal,
// Character, System, Class, Object
public final class Integer extends Number
implements Comparable
{
public Integer(String s)
throws NumberFormatException
{
value = parseInt(s, 10);
}
public Integer(int value)
{
this.value = value;
}
static void appendTo(int i, StringBuffer sb)
{
switch(i)
{
case -2147483648:
sb.append("-2147483648");
return;
case -3:
sb.append("-3");
return;
case -2:
sb.append("-2");
return;
case -1:
sb.append("-1");
return;
case 0: // '\0'
sb.append("0");
return;
case 1: // '\001'
sb.append("1");
return;
case 2: // '\002'
sb.append("2");
return;
case 3: // '\003'
sb.append("3");
return;
case 4: // '\004'
sb.append("4");
return;
case 5: // '\005'
sb.append("5");
return;
case 6: // '\006'
sb.append("6");
return;
case 7: // '\007'
sb.append("7");
return;
case 8: // '\b'
sb.append("8");
return;
case 9: // '\t'
sb.append("9");
return;
case 10: // '\n'
sb.append("10");
return;
}
char buf[] = (char[])perThreadBuffer.get();
int charPos = getChars(i, buf);
sb.append(buf, charPos, 12 - charPos);
}
public byte byteValue()
{
return (byte)value;
}
public int compareTo(Object o)
{
return compareTo((Integer)o);
}
public int compareTo(Integer anotherInteger)
{
int thisVal = value;
int anotherVal = anotherInteger.value;
return thisVal >= anotherVal ? ((int) (thisVal != anotherVal ? 1 : 0)) : -1;
}
public static Integer decode(String nm)
throws NumberFormatException
{
int radix;
int index;
boolean negative;
radix = 10;
index = 0;
negative = false;
if(nm.startsWith("-"))
{
negative = true;
index++;
}
if(nm.startsWith("0x", index) || nm.startsWith("0X", index))
{
index += 2;
radix = 16;
} else
if(nm.startsWith("#", index))
{
index++;
radix = 16;
} else
if(nm.startsWith("0", index) && nm.length() > 1 + index)
{
index++;
radix = 8;
}
if(nm.startsWith("-", index))
throw new NumberFormatException("Negative sign in wrong position");
Integer result;
result = valueOf(nm.substring(index), radix);
result = negative ? new Integer(-result.intValue()) : result;
break MISSING_BLOCK_LABEL_216;
NumberFormatException e;
e;
String constant = negative ? new String("-" + nm.substring(index)) : nm.substring(index);
result = valueOf(constant, radix);
return result;
}
public double doubleValue()
{
return (double)value;
}
public boolean equals(Object obj)
{
if(obj instanceof Integer)
return value == ((Integer)obj).intValue();
else
return false;
}
public float floatValue()
{
return (float)value;
}
private static int getChars(int i, char buf[])
{
int charPos = 12;
char sign = '\0';
if(i < 0)
{
sign = '-';
i = -i;
}
while(i >= 0x10000)
{
int q = i / 100;
int r = i - ((q << 6) + (q << 5) + (q << 2));
i = q;
buf[--charPos] = DigitOnes[r];
buf[--charPos] = DigitTens[r];
}
do
{
int q = i * 52429 >>> 19;
int r = i - ((q << 3) + (q << 1));
buf[--charPos] = digits[r];
i = q;
} while(i != 0);
if(sign != 0)
buf[--charPos] = sign;
return charPos;
}
public static Integer getInteger(String nm, Integer val)
{
String v = null;
v = System.getProperty(nm);
break MISSING_BLOCK_LABEL_20;
IllegalArgumentException e;
e;
break MISSING_BLOCK_LABEL_20;
NullPointerException e;
e;
if(v == null)
break MISSING_BLOCK_LABEL_34;
return decode(v);
e;
return val;
}
public static Integer getInteger(String nm, int val)
{
Integer result = getInteger(nm, ((Integer) (null)));
return result != null ? result : new Integer(val);
}
public static Integer getInteger(String nm)
{
return getInteger(nm, ((Integer) (null)));
}
public int hashCode()
{
return value;
}
public int intValue()
{
return value;
}
public long longValue()
{
return (long)value;
}
public static int parseInt(String s)
throws NumberFormatException
{
return parseInt(s, 10);
}
public static int parseInt(String s, int radix)
throws NumberFormatException
{
if(s == null)
throw new NumberFormatException("null");
if(radix < 2)
throw new NumberFormatException("radix " + radix + " less than Character.MIN_RADIX");
if(radix > 36)
throw new NumberFormatException("radix " + radix + " greater than Character.MAX_RADIX");
int result = 0;
boolean negative = false;
int i = 0;
int max = s.length();
if(max > 0)
{
int limit;
if(s.charAt(0) == '-')
{
negative = true;
limit = 0x80000000;
i++;
} else
{
limit = 0x80000001;
}
int multmin = limit / radix;
if(i < max)
{
int digit = Character.digit(s.charAt(i++), radix);
if(digit < 0)
throw NumberFormatException.forInputString(s);
result = -digit;
}
while(i < max)
{
int digit = Character.digit(s.charAt(i++), radix);
if(digit < 0)
throw NumberFormatException.forInputString(s);
if(result < multmin)
throw NumberFormatException.forInputString(s);
result *= radix;
if(result < limit + digit)
throw NumberFormatException.forInputString(s);
result -= digit;
}
} else
{
throw NumberFormatException.forInputString(s);
}
if(negative)
{
if(i > 1)
return result;
else
throw NumberFormatException.forInputString(s);
} else
{
return -result;
}
}
public void setValue(int value)
{
this.value = value;
}
public short shortValue()
{
return (short)value;
}
public static String toBinaryString(int i)
{
return toUnsignedString(i, 1);
}
public static String toHexString(int i)
{
return toUnsignedString(i, 4);
}
public static String toOctalString(int i)
{
return toUnsignedString(i, 3);
}
public String toString()
{
return String.valueOf(value);
}
public static String toString(int i)
{
switch(i)
{
case -2147483648:
return "-2147483648";
case -3:
return "-3";
case -2:
return "-2";
case -1:
return "-1";
case 0: // '\0'
return "0";
case 1: // '\001'
return "1";
case 2: // '\002'
return "2";
case 3: // '\003'
return "3";
case 4: // '\004'
return "4";
case 5: // '\005'
return "5";
case 6: // '\006'
return "6";
case 7: // '\007'
return "7";
case 8: // '\b'
return "8";
case 9: // '\t'
return "9";
case 10: // '\n'
return "10";
}
char buf[] = (char[])perThreadBuffer.get();
int charPos = getChars(i, buf);
return new String(buf, charPos, 12 - charPos);
}
public static String toString(int i, int radix)
{
if(radix < 2 || radix > 36)
radix = 10;
if(radix == 10)
return toString(i);
char buf[] = new char[33];
boolean negative = i < 0;
int charPos = 32;
if(!negative)
i = -i;
for(; i <= -radix; i /= radix)
buf[charPos--] = digits[-(i % radix)];
buf[charPos] = digits[-i];
if(negative)
buf[--charPos] = '-';
return new String(buf, charPos, 33 - charPos);
}
private static String toUnsignedString(int i, int shift)
{
char buf[] = new char[32];
int charPos = 32;
int radix = 1 << shift;
int mask = radix - 1;
do
{
buf[--charPos] = digits[i & mask];
i >>>= shift;
} while(i != 0);
return new String(buf, charPos, 32 - charPos);
}
public static Integer valueOf(String s)
throws NumberFormatException
{
return new Integer(parseInt(s, 10));
}
public static Integer valueOf(String s, int radix)
throws NumberFormatException
{
return new Integer(parseInt(s, radix));
}
static final char DigitOnes[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'
};
static final char DigitTens[] = {
'0', '0', '0', '0', '0', '0', '0', '0', '0', '0',
'1', '1', '1', '1', '1', '1', '1', '1', '1', '1',
'2', '2', '2', '2', '2', '2', '2', '2', '2', '2',
'3', '3', '3', '3', '3', '3', '3', '3', '3', '3',
'4', '4', '4', '4', '4', '4', '4', '4', '4', '4',
'5', '5', '5', '5', '5', '5', '5', '5', '5', '5',
'6', '6', '6', '6', '6', '6', '6', '6', '6', '6',
'7', '7', '7', '7', '7', '7', '7', '7', '7', '7',
'8', '8', '8', '8', '8', '8', '8', '8', '8', '8',
'9', '9', '9', '9', '9', '9', '9', '9', '9', '9'
};
public static final int MAX_VALUE = 0x7fffffff;
public static final int MIN_VALUE = 0x80000000;
public static final Class TYPE = Class.getPrimitiveClass("int");
static final char digits[] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
'u', 'v', 'w', 'x', 'y', 'z'
};
private static ThreadLocal perThreadBuffer = new ThreadLocal() {
protected synchronized Object initialValue()
{
return new char[12];
}
};
private static final long serialVersionUID = 0x12e2a0a4f7818738L;
private int value;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -