Example usage for java.lang Byte toString

List of usage examples for java.lang Byte toString

Introduction

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

Prototype

public static String toString(byte b) 

Source Link

Document

Returns a new String object representing the specified byte .

Usage

From source file:Main.java

public static void main(String[] args) {
    byte b = 65;

    System.out.println(Byte.toString(b));

}

From source file:Main.java

public static void main(String[] args) {

    byte b = 10;
    System.out.println("str:" + Byte.toString(b));

}

From source file:Main.java

public static String fromBcdToString(byte b) {
    return Byte.toString((byte) fromBcd(b));
}

From source file:Main.java

static CharSequence displayByteArray(byte[] bytes) {
    StringBuilder builder = new StringBuilder().append("[");
    for (int i = 0; i < bytes.length; i++) {
        builder.append(Byte.toString(bytes[i]));
        if (i + 1 < bytes.length) {
            builder.append(", ");
        }//from  www .  j av a 2  s .c  om
    }
    return builder.append("]");
}

From source file:com.marklogic.contentpump.utilities.EncodingUtil.java

/**
 *  Oracle jdk bug 4508058: UTF-8 encoding does not recognize
 *  initial BOM, and it will not be fixed. 
 *  Work Around :/*from   w  ww .ja v  a 2s.  co  m*/
 *  Application code must recognize and skip the BOM itself.
 */
public static void handleBOMUTF8(String[] vales, int i) {
    byte[] buf = vales[i].getBytes();
    if (LOG.isDebugEnabled()) {
        StringBuilder sb = new StringBuilder();
        for (byte b : buf) {
            sb.append(Byte.toString(b));
            sb.append(" ");
        }
        LOG.debug(vales[i]);
        LOG.debug(sb.toString());
    }
    if (buf[0] == (byte) 0xEF && buf[1] == (byte) 0xBB && buf[2] == (byte) 0xBF) {
        vales[i] = new String(buf, 3, buf.length - 3);
    }
}

From source file:com.moscona.dataSpace.debug.ByteBufferTest.java

public static void print(String label, ByteBuffer buf) {
    System.out.println(label + ":");
    ArrayList<String> l = new ArrayList<String>();
    for (byte b : buf.array()) {
        l.add(Byte.toString(b));
    }//from   w w w.j a  va  2 s .  c  o m
    System.out.println("  " + StringUtils.join(l, ", "));
}

From source file:net.floodlightcontroller.loadbalancer.LBVipSerializer.java

@Override
public void serialize(LBVip vip, JsonGenerator jGen, SerializerProvider serializer)
        throws IOException, JsonProcessingException {
    jGen.writeStartObject();/*from   w  w w . j a  v a2s.c o m*/

    jGen.writeStringField("name", vip.name);
    jGen.writeStringField("id", vip.id);
    jGen.writeStringField("address", String.valueOf(vip.address));
    jGen.writeStringField("protocol", Byte.toString(vip.protocol));
    jGen.writeStringField("port", Short.toString(vip.port));

    jGen.writeEndObject();
}

From source file:com.thruzero.common.core.support.Time.java

@Override
public String toString() {
    return StringUtils.leftPad(Byte.toString(hours), 2, "0") + ":"
            + StringUtils.leftPad(Byte.toString(minutes), 2, "0");
}

From source file:de.doncarnage.minecraft.baseplugin.util.ItemUtil.java

/**
 * Returns the item string of a MaterialData object as string.
 *
 * @param md the {@link MaterialData} for which the string should be looked up
 * @return the string representing the {@link MaterialData} object
 *//*from w  w  w  . j av a2s . co m*/
@SuppressWarnings("deprecation")
public static String getItemStringFromMaterialData(MaterialData md) {
    return String.format("%s%s", md.getItemType().name(),
            md.getData() != 0 ? ":" + Byte.toString(md.getData()) : "");
}

From source file:cn.ctyun.amazonaws.util.StringUtils.java

/**
 * Returns the string representation of the specified Byte.
 *
 * @param b/*from  www. jav a2 s  .c o  m*/
 *            The Byte to represent as a string.
 *
 * @return The string representation of the specified Byte.
 */
public static String fromByte(Byte b) {
    return Byte.toString(b);
}