Java by API/java.lang/Byte
Содержание
Byte: byteValue()
<source lang="java">
public class Main {
public static void main(String[] args) { byte by = (byte) "A"; Byte by2 = new Byte(by); System.out.println(by2.byteValue()); }
}
</source>
Byte: doubleValue()
<source lang="java">
public class Main {
public static void main(String[] args) { Byte bObj = new Byte("10"); byte b = bObj.byteValue(); System.out.println(b); short s = bObj.shortValue(); System.out.println(s); int i = bObj.intValue(); System.out.println(i); float f = bObj.floatValue(); System.out.println(f); double d = bObj.doubleValue(); System.out.println(d); long l = bObj.longValue(); System.out.println(l); }
}
</source>
Byte: floatValue()
<source lang="java">
public class Main {
public static void main(String[] args) { Byte bObj = new Byte("10"); byte b = bObj.byteValue(); System.out.println(b); short s = bObj.shortValue(); System.out.println(s); int i = bObj.intValue(); System.out.println(i); float f = bObj.floatValue(); System.out.println(f); double d = bObj.doubleValue(); System.out.println(d); long l = bObj.longValue(); System.out.println(l); }
}
</source>
Byte: intValue()
<source lang="java">
public class Main {
public static void main(String[] args) { Byte bObj = new Byte("10"); byte b = bObj.byteValue(); System.out.println(b); short s = bObj.shortValue(); System.out.println(s); int i = bObj.intValue(); System.out.println(i); float f = bObj.floatValue(); System.out.println(f); double d = bObj.doubleValue(); System.out.println(d); long l = bObj.longValue(); System.out.println(l); }
}
</source>
Byte: longValue()
<source lang="java">
public class Main {
public static void main(String[] args) { Byte bObj = new Byte("10"); byte b = bObj.byteValue(); System.out.println(b); short s = bObj.shortValue(); System.out.println(s); int i = bObj.intValue(); System.out.println(i); float f = bObj.floatValue(); System.out.println(f); double d = bObj.doubleValue(); System.out.println(d); long l = bObj.longValue(); System.out.println(l); }
}
</source>
Byte.MAX_VALUE
<source lang="java">
public class Main {
public static void main(String[] args) { System.out.println(Byte.MIN_VALUE); System.out.println(Byte.MAX_VALUE); }
} /* -128 127
- /
</source>
Byte.MIN_VALUE
<source lang="java">
public class Main {
public static void main(String[] args) { System.out.println(Byte.MIN_VALUE); System.out.println(Byte.MAX_VALUE); }
} /* -128 127
- /
</source>
Byte: shortValue()
<source lang="java">
public class Main {
public static void main(String[] args) { Byte bObj = new Byte("10"); byte b = bObj.byteValue(); System.out.println(b); short s = bObj.shortValue(); System.out.println(s); int i = bObj.intValue(); System.out.println(i); float f = bObj.floatValue(); System.out.println(f); double d = bObj.doubleValue(); System.out.println(d); long l = bObj.longValue(); System.out.println(l); }
}
</source>
Byte: toString(byte b)
<source lang="java">
public class Main {
public static void main(String[] args) { byte b = 65; System.out.println(Byte.toString(b)); }
}
</source>
Byte: valueOf(String stringValue)
<source lang="java">
/*
* Output:
true c 12 2 13245 12341234 11234.123 4.321324123412341E10
*/
public class MainClass {
public static void main(String args[]) { Boolean bool = Boolean.valueOf("true"); Character c = new Character("c"); Byte b = Byte.valueOf("12"); Short s = Short.valueOf("2"); Integer i = Integer.valueOf("13245"); Long l = Long.valueOf("12341234"); Float f = Float.valueOf("11234.1234"); Double d = Double.valueOf("43213241234.123412341234"); System.out.println(bool); System.out.println(c); System.out.println(b); System.out.println(s); System.out.println(i); System.out.println(l); System.out.println(f); System.out.println(d); }
}
</source>
new Byte(byte value)
<source lang="java">
public class Main {
public static void main(String[] args) { byte i = 10; Byte bObj = new Byte(i); System.out.println(bObj); }
}
</source>
new Byte(String s)
<source lang="java">
public class Main {
public static void main(String[] args) { Byte bObj = new Byte("10"); String str = bObj.toString(); System.out.println(str); }
}
</source>