Example usage for java.lang Byte Byte

List of usage examples for java.lang Byte Byte

Introduction

In this page you can find the example usage for java.lang Byte Byte.

Prototype

@Deprecated(since = "9")
public Byte(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Byte object that represents the byte value indicated by the String parameter.

Usage

From source file:Main.java

public static void main(String[] args) {
    Byte byteObject = new Byte("10");

    int i = byteObject.intValue();
    System.out.println("int:" + i);

}

From source file:Main.java

public static void main(String[] args) {
    Byte byteObject = new Byte("10");

    double d = byteObject.doubleValue();
    System.out.println("double:" + d);

}

From source file:Main.java

public static void main(String[] args) {
    Byte b1 = new Byte("100");
    Byte b2 = new Byte("-100");

    int i1 = b1.hashCode();
    int i2 = b2.hashCode();

    String str1 = "Hashcode of Byte " + b1 + " is " + i1;
    String str2 = "Hashcode of Byte " + b2 + " is " + i2;

    System.out.println(str1);/*from   w ww .  j  a v a  2s  . c om*/
    System.out.println(str2);
}

From source file:Main.java

public static void main(String[] args) {
    byte i = 10;/*  w  w w . j a  v a 2 s  .  c o  m*/

    Byte bObj = new Byte(i);
    System.out.println(bObj);
}

From source file:Main.java

public static void main(String[] args) {
    Byte bObj = new Byte("10");
    byte b = bObj.byteValue();
    System.out.println(b);/*from   w w  w . j a v a  2 s  .c o  m*/
    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);

}

From source file:Main.java

public static void main(String[] args) {
    byte b = 10;/*from   w ww.  j  a  v a 2  s  .c  om*/
    Byte bObj1 = new Byte(b);
    Byte bObj2 = new Byte("4");

    System.out.println(bObj1);
    System.out.println(bObj2);
}

From source file:Main.java

public static void main(String[] args) {

    byte b = 101;
    Byte byteObject2 = new Byte(b);
    System.out.println(byteObject2);

}

From source file:MainClass.java

public static void main(String[] args) {
    byte by = (byte) 'A';
    Byte by2 = new Byte(by);
    System.out.println(by2.byteValue());
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    Boolean refBoolean = new Boolean(true);
    boolean bool = refBoolean.booleanValue();

    Byte refByte = new Byte((byte) 123);
    byte b = refByte.byteValue();

    Character refChar = new Character('x');
    char c = refChar.charValue();

    Short refShort = new Short((short) 123);
    short s = refShort.shortValue();

    Integer refInt = new Integer(123);
    int i = refInt.intValue();

    Long refLong = new Long(123L);
    long l = refLong.longValue();

    Float refFloat = new Float(12.3F);
    float f = refFloat.floatValue();

    Double refDouble = new Double(12.3D);
    double d = refDouble.doubleValue();
}

From source file:Main.java

/**
 * convert a byte to a char/* w w w  .j a  v a 2s. c om*/
 * @param b
 * @return
 */
static public char findHex(byte b) {
    int t = new Byte(b).intValue();
    t = t < 0 ? t + 16 : t;
    if ((0 <= t) && (t <= 9)) {
        return (char) (t + '0');
    }
    return (char) (t - 10 + 'A');
}