Example usage for java.lang Byte valueOf

List of usage examples for java.lang Byte valueOf

Introduction

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

Prototype

public static Byte valueOf(String s) throws NumberFormatException 

Source Link

Document

Returns a Byte object holding the value given by the specified String .

Usage

From source file:Main.java

public static void main(String[] args) {

    System.out.println(Byte.valueOf((byte) 12));
}

From source file:Main.java

public static void main(String[] args) {

    System.out.println("parse string to byte:" + Byte.valueOf("10"));
}

From source file:Main.java

public static void main(String[] args) {
    String s = "65";

    byte b = Byte.valueOf(s);

    System.out.println(b);/*from  ww  w.  j a v a  2 s.  com*/

    // Causes a NumberFormatException since the value is out of range
    System.out.println(Byte.valueOf("129"));
}

From source file:Main.java

public static void main(String[] args) {
    Byte bObj1 = new Byte("100");
    System.out.println(bObj1);/*  w w w  .j a v  a2 s.  com*/
    Byte bObj2 = Byte.valueOf("100");
    System.out.println(bObj2);
}

From source file:MainClass.java

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);/*from   w w  w.j a  v  a  2s .  c om*/
    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);
}

From source file:Main.java

private static byte ValueOf(String string) {
    return Byte.valueOf(string);
}

From source file:Main.java

public static byte getByteValue(Element paramElement) {
    return Byte.valueOf(getText(paramElement)).byteValue();
}

From source file:Main.java

public static String bytesToHexString(byte abyte0[]) {
    StringBuilder stringbuilder = new StringBuilder();
    for (int i = 0; i < abyte0.length; i++) {
        stringbuilder.append(String.format("%02x ", new Object[] { Byte.valueOf(abyte0[i]) }));
    }//from   ww  w .jav a  2  s  . c o  m

    return stringbuilder.toString();
}

From source file:Main.java

public static String bytesToNoSpaceHexString(byte abyte0[]) {
    StringBuilder stringbuilder = new StringBuilder();
    for (int i = 0; i < abyte0.length; i++) {
        stringbuilder.append(String.format("%02x", new Object[] { Byte.valueOf(abyte0[i]) }));
    }/* w w w .j ava  2 s. co  m*/

    return stringbuilder.toString();
}

From source file:Main.java

/**
 * get byte value/*w  ww. j ava2 s.  com*/
 * 
 * @param player
 * @param name
 * @return
 */
public static byte getByteValue(Element e) {
    return Byte.valueOf(getText(e));
}