📄 byte.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 Byte extends Number implements Comparable { public static final byte MIN_VALUE = -128; public static final byte MAX_VALUE = 127; public static final Class TYPE = Class.getPrimitiveType(Class.T_BYTE); private byte value; public Byte(byte value) { this.value = value; } public Byte(String s) throws NumberFormatException { value = parseByte(s, 10); } public static String toString(byte b) { return Integer.toString((int) b, 10); } public static byte parseByte(String s) throws NumberFormatException { return parseByte(s, 10); } public static byte parseByte(String s, int radix) throws NumberFormatException { int result = Integer.parseInt(s, radix); if (result < MIN_VALUE || result > MAX_VALUE) throw new NumberFormatException(); return (byte) result; } public static Byte valueOf(String s, int radix) throws NumberFormatException { return new Byte(parseByte(s, radix)); } public static Byte valueOf(String s) throws NumberFormatException { return valueOf(s, 10); } public static Byte 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 Byte((byte) i); } public byte byteValue() { return value; } public short shortValue() { return (short) 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 value; } public boolean equals(Object obj) { return obj instanceof Byte && value == ((Byte) obj).value; } public int compareTo(Byte anotherByte) { return value - anotherByte.value; } public int compareTo(Object o) { return compareTo((Byte) o); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -