Java Byte Array Create toByteArray(final byte[] bytes)

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

Description

Produces an array of Byte objects from an array of bytes.

License

Open Source License

Parameter

Parameter Description
bytes the array to be converted

Return

an array of Byte objects

Declaration

public static Byte[] toByteArray(final byte[] bytes) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from www  .ja va  2  s  .  co m*/
     * Produces an array of Byte objects from an array of bytes.
     * <p>
     * Can be used to produce an array of objects to feed an iterator
     * 
     * @param bytes the array to be converted
     * @return an array of Byte objects
     */
    public static Byte[] toByteArray(final byte[] bytes) {
        final Byte[] result = new Byte[bytes.length];
        for (int i = 0; i < bytes.length; i++) {
            result[i] = Byte.valueOf(bytes[i]);
        }
        return result;
    }
}

Related

  1. toByteArray(char[] chars)
  2. toByteArray(char[] chars)
  3. toByteArray(char[] src)
  4. toByteArray(CharSequence hexString)
  5. toByteArray(double[][] array)
  6. toByteArray(final byte[][] array)
  7. toByteArray(final char[] array)
  8. toByteArray(final char[] array)
  9. toByteArray(final int i)