Example usage for java.lang Byte byteValue

List of usage examples for java.lang Byte byteValue

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public byte byteValue() 

Source Link

Document

Returns the value of this Byte as a byte .

Usage

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[] args) {
    Byte byteObject = new Byte("10");
    byte b = byteObject.byteValue();
    System.out.println("byte:" + b);

}

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  ava2 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[] 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

static byte[] getArray(ArrayList<Byte> arrayList) {
    byte[] array = new byte[arrayList.size()];
    int i = 0;/* www  .j av a  2  s .  c om*/
    for (Byte value : arrayList) {
        array[i] = value.byteValue();
        i++;
    }
    return array;
}

From source file:Main.java

/**
 * Helper method/*  www . j a  v  a2s  . c  o  m*/
 * <p/>
 * Used by {@link OfflineUtilities#getUncomplessedOfflineFile(FileInputStream)}
 * Takes in the input stream for the offline storage and reads the contents into a byte array
 *
 * @param file The input stream for the offline storage {@see android.content.Context#openFileInput(String)}
 * @return The byte array representation of the offline file
 * @throws IOException If  something goes wrong with the file reading
 */
private static byte[] fileToArr(FileInputStream file) throws IOException {
    List<Byte> tripFile = new ArrayList<>();
    for (byte b; (b = (byte) file.read()) != -1;) {
        tripFile.add(b);
    }
    byte[] tripBytes = new byte[tripFile.size()];
    int pos = 0;
    for (Byte b : tripFile) {
        tripBytes[pos++] = b.byteValue();
    }
    return tripBytes;
}

From source file:Main.java

/**
 * unbox Byte//  ww w  .  j a  va2 s. c o  m
 */
public static byte unboxed(Byte v) {
    return v == null ? 0 : v.byteValue();
}

From source file:com.hbc.api.trade.bdata.common.util.ParameterValidator.java

/**
 * @param paramValue ??//from   www . ja  v  a 2 s .  c o  m
 * @param paramNameTip ????
 */
public static void validateParamNumberGreaterThan0(Byte paramValue, String paramNameTip) {
    if (paramValue == null || paramValue.byteValue() < 0) {
        throw new ParamValidateException(CommonReturnCodeEnum.PARAM_ERROR_WITHARG, paramNameTip);
    }
}

From source file:Main.java

/**
 * Converts to primitive array.//  w w w .ja  v  a  2  s. co m
 */
public static byte[] values(Byte[] array) {
    byte[] dest = new byte[array.length];
    for (int i = 0; i < array.length; i++) {
        Byte v = array[i];
        if (v != null) {
            dest[i] = v.byteValue();
        }
    }
    return dest;
}

From source file:com.healthmarketscience.jackcess.DataTypes.java

public static byte fromSQLType(int sqlType) throws SQLException {
    Byte b = (Byte) SQL_TYPES.getKey(new Integer(sqlType));
    if (b != null) {
        return b.byteValue();
    } else {/*from w  w w.ja v a 2  s  .c  om*/
        throw new SQLException("Unsupported SQL type: " + sqlType);
    }
}