📄 short.java
字号:
/* libaegisvm - The Aegis Virtual Machine for executing Java bytecode Copyright (C) 2001-2002 Philip W. L. Fong This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA*/package java.lang;public final class Short extends Number implements Comparable { public static final short MIN_VALUE = -32768; public static final short MAX_VALUE = 32767; public static final Class TYPE = Class.getPrimitiveType(Class.T_SHORT); private short value; public Short(short value) { this.value = value; } public Short(String s) throws NumberFormatException { this.value = parseShort(s, 10); } public static String toString(short s) { return Integer.toString((int) s, 10); } public static short parseShort(String s) throws NumberFormatException { return parseShort(s, 10); } public static short parseShort(String s, int radix) throws NumberFormatException { int result = Integer.parseInt(s, radix); if (result < MIN_VALUE || result > MAX_VALUE) throw new NumberFormatException(); return (short) result; } public static Short valueOf(String s, int radix) throws NumberFormatException { return new Short(parseShort(s, radix)); } public static Short valueOf(String s) throws NumberFormatException { return valueOf(s, 10); } public static Short decode(String nm) throws NumberFormatException { Integer iv = Integer.decode(nm); int i = iv.intValue(); if (i < MIN_VALUE && i > MAX_VALUE) throw new NumberFormatException(); return new Short((short) i); } public byte byteValue() { return (byte) value; } public short shortValue() { return value; } public int intValue() { return (int) value; } public long longValue() { return (long) value; } public float floatValue() { return (float) value; } public double doubleValue() { return (double) value; } public String toString() { return toString(value); } public int hashCode() { return (int) value; } public boolean equals(Object obj) { return obj instanceof Short && value == ((Short) obj).value; } public int compareTo(Short anotherShort) { return value - anotherShort.value; } public int compareTo(Object o) { return compareTo((Short) o); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -