📄 数值类型.txt
字号:
011: System.out.println("/n/nAfter reseeding generator:");
012: for (int i = 0; i < 32; i++)
013: System.out.print(generator.nextInt(100) + " /t");
014: }
015: }
Return to top
--------------------------------------------------------------------------------
数值类型 List.14 Boolean.txt
Return to top
001: // Boolean wrapper class fields
002: public static final Boolean TRUE;
003: public static final Boolean FALSE;
004:
005: // Boolean wrapper class constructors
006: public Boolean(boolean value);
007: public Boolean(String s);
008:
009: // Boolean wrapper class methods
010: public boolean booleanValue();
011: public static Boolean valueOf(String s);
012: public String toString();
013: public int hashCode();
014: public boolean equals(Object obj);
015: public static boolean getBoolean(String name);
Return to top
--------------------------------------------------------------------------------
数值类型 List.15 BooleanDemo/BooleanDemo.java
Return to top
001: class BooleanDemo {
002: public static void main(String args[]) {
003: // Shows that TRUE and FALSE are objects
004: Boolean boolObject = new Boolean(true);
005: if (boolObject.equals(Boolean.TRUE))
006: System.out.println("boolObject is true");
007: // But that true and false are native values
008: boolean boolValue = true;
009: if (boolValue = Boolean.TRUE.booleanValue())
010: System.out.println("boolValue is true");
011: }
012: }
Return to top
--------------------------------------------------------------------------------
数值类型 List.16 GetProperty/GetProperty.java
Return to top
001: class GetProperty {
002: static String DEBUGGINGPROP = "Debugging.prop";
003: static String NAMEPROP = "Program.name.prop";
004: static String NAMEVALUE = "GetProperty";
005:
006: public static void main(String args[]) {
007: System.setProperty(DEBUGGINGPROP, "true"); // Boolean prop
008: System.setProperty(NAMEPROP, NAMEVALUE); // Other prop
009:
010: boolean result;
011: String valueStr;
012:
013: // Get true or false value of boolean property
014: result = Boolean.getBoolean(DEBUGGINGPROP);
015: System.out.println(DEBUGGINGPROP + " = " + result);
016:
017: // Get value of non-boolean property
018: valueStr = System.getProperty(NAMEPROP);
019: result = Boolean.getBoolean(NAMEPROP);
020: System.out.println(NAMEPROP + " value = " + valueStr);
021: System.out.println(NAMEPROP + " result = " + result);
022: }
023: }
Return to top
--------------------------------------------------------------------------------
数值类型 List.17 IntCommon.txt
Return to top
001: // Common to Short, Byte, Integer, and Long classes
002: public byte byteValue();
003: public short shortValue();
004: public int intValue();
005: public long longValue();
006: public float floatValue();
007: public double doubleValue();
008: public String toString();
009: public int hashCode();
010: public boolean equals(Object obj);
011: public int compareTo(Object o);
Return to top
--------------------------------------------------------------------------------
数值类型 List.18 Integer.txt
Return to top
001: // Integer wrapper class constructors
002: public Integer(int value);
003: public Integer(String s);
004:
005: // Integer wrapper class methods
006: public static String toString(int i, int radix);
007: public static String toHexString(int i);
008: public static String toOctalString(int i);
009: public static String toBinaryString(int i);
010: public static String toString(int i);
011: public static int parseInt(String s, int radix);
012: public static int parseInt(String s);
013: public static Integer valueOf(String s, int radix);
014: public static Integer valueOf(String s);
015: public int compareTo(Integer anotherInteger);
016:
017: // Integer wrapper class property methods
018: public static Integer getInteger(String nm);
019: public static Integer getInteger(String nm, int val);
020: public static Integer getInteger(String nm, Integer val);
021: public static Integer decode(String nm);
Return to top
--------------------------------------------------------------------------------
数值类型 List.19 ConvertInt/ConvertInt.java
Return to top
001: class ConvertInt {
002: public static void main(String args[]) {
003: if (args.length < 1)
004: System.out.println("ex. java ConvertInt 1234");
005: else
006: try {
007: int intValue = Integer.parseInt(args[0]);
008: System.out.println("Default = "
009: + Integer.toString(intValue));
010: System.out.println("Hex = "
011: + Integer.toHexString(intValue));
012: System.out.println("Octal = "
013: + Integer.toOctalString(intValue));
014: System.out.println("Binary = "
015: + Integer.toBinaryString(intValue));
016: System.out.println("base 32 = "
017: + Integer.toString(intValue, 32));
018: } catch (NumberFormatException e) {
019: System.out.println(
020: "Format error in argument " + e.getMessage());
021: }
022: }
023: }
Return to top
--------------------------------------------------------------------------------
数值类型 List.20 Long.txt
Return to top
001: // Long wrapper class constructors
002: public Long(long value);
003: public Long(String s);
004:
005: // Long wrapper class methods
006: public static String toString(long i, int radix);
007: public static String toHexString(long i);
008: public static String toOctalString(long i);
009: public static String toBinaryString(long i);
010: public static String toString(long i);
011: public static long parseLong(String s, int radix);
012: public static long parseLong(String s);
013: public static Long valueOf(String s, int radix);
014: public static Long valueOf(String s);
015: public static Long decode(String nm);
016: public int compareTo(Long anotherLong);
017:
018: // Long wrapper class property methods
019: public static Long getLong(String nm);
020: public static Long getLong(String nm, long val);
021: public static Long getLong(String nm, Long val);
Return to top
--------------------------------------------------------------------------------
数值类型 List.21 Byte.txt
Return to top
001: // Byte wrapper class constructors
002: public Byte(byte value);
003: public Byte(String s);
004:
005: // Byte wrapper class methods
006: public static String toString(byte b);
007: public static byte parseByte(String s);
008: public static byte parseByte(String s, int radix);
009: public static Byte valueOf(String s, int radix);
010: public static Byte valueOf(String s);
011: public static Byte decode(String nm);
012: public int compareTo(Byte anotherByte);
Return to top
--------------------------------------------------------------------------------
数值类型 List.22 Short.txt
Return to top
001: // Short wrapper class constructors
002: public Short(short value);
003: public Short(String s);
004:
005: // Short wrapper class methods
006: public static String toString(short s);
007: public static short parseShort(String s);
008: public static short parseShort(String s, int radix);
009: public static Short valueOf(String s, int radix);
010: public static Short valueOf(String s);
011: public static Short decode(String nm);
012: public int compareTo(Short anotherShort);
Return to top
--------------------------------------------------------------------------------
数值类型 List.23 FloatCommon.txt
Return to top
001: // Common to Float and Double classes
002: public static final double POSITIVE_INFINITY;
003: public static final double NEGATIVE_INFINITY;
004: public static final double NaN;
005: public static final double MAX_VALUE;
006: public static final double MIN_VALUE;
007: public boolean isNaN();
008: public boolean isInfinite();
Return to top
--------------------------------------------------------------------------------
数值类型 List.24 Float.txt
Return to top
001: // Float wrapper class constructors
002: public Float(float value);
003: public Float(double value);
004: public Float(String s);
005:
006: // Float wrapper class methods
007: public static String toString(float f);
008: public static Float valueOf(String s);
009: public static float parseFloat(String s);
010: static public boolean isNaN(float v);
011: static public boolean isInfinite(float v);
012: public int compareTo(Float anotherFloat);
013:
014: // Float wrapper class bit converters
015: public static native int floatToIntBits(float value);
016: public static native float intBitsToFloat(int bits);
Return to top
--------------------------------------------------------------------------------
数值类型 List.25 ParseFloat/ParseFloat.java
Return to top
001: class ParseFloat {
002: public static void main(String args[]) {
003: if (args.length < 1)
004: System.out.println("ex. java ParseFloat 3.14159");
005: else {
006: try {
007: float f = Float.parseFloat(args[0]);
008: System.out.println("Value == " + f);
009: } catch (NumberFormatException e) {
010: System.out.println("Error in argument " + e.getMessage());
011: }
012: }
013: }
014: }
Return to top
--------------------------------------------------------------------------------
数值类型 List.26 Double.txt
Return to top
001: // Double wrapper class constructors
002: public Double(double value);
003: public Double(String s);
004:
005: // Double wrapper class methods
006: public static String toString(double d);
007: public static Double valueOf(String s);
008: public static double parseDouble(String s);
009: static public boolean isNaN(double v);
010: static public boolean isInfinite(double v);
011: public int compareTo(Double anotherDouble);
012:
013: // Double wrapper class bit converters
014: public static native long doubleToLongBits(double value);
015: public static native long doubleToRawLongBits(double value);
016: public static native double longBitsToDouble(long bits);
Return to top
? 2003 by ChinaITL
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -