Java Decimal decimalDump(final byte[] bytes)

Here you can find the source of decimalDump(final byte[] bytes)

Description

Dumps the byte array into a string as a series of 8bit decimal numbers

License

Apache License

Parameter

Parameter Description
bytes a parameter

Declaration

public static String decimalDump(final byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    private static final int SINGLE_BYTE_SIGN_MASK = 0xFF;

    /**// w  ww .j  a va 2s  .  c o  m
     * Dumps the byte array into a string as a series of 8bit decimal numbers
     * 
     * @param bytes
     * @return
     */
    public static String decimalDump(final byte[] bytes) {
        StringBuffer buffer = new StringBuffer();
        for (byte b : bytes) {
            buffer.append(Byte.toString((byte) (b & SINGLE_BYTE_SIGN_MASK)));
            buffer.append(" ");
        }

        return buffer.toString();
    }
}

Related

  1. decimalAlign(int width, int precision, String s)
  2. decimalDigit(final long value, final int i)
  3. decimalDigitCount(int num)
  4. decimalPart(float f)
  5. decimalPart(float number)
  6. decimalPlace(float theValue, int theDecimalPlaces)
  7. decimalPlaces(double value, int precision)