Java Convert via ByteBuffer toBuffer(byte[] arr)

Here you can find the source of toBuffer(byte[] arr)

Description

to Buffer

License

Apache License

Declaration

public static ByteBuffer toBuffer(byte[] arr) 

Method Source Code


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

import java.nio.ByteBuffer;

public class Main {
    public static ByteBuffer toBuffer(byte[] arr) {
        ByteBuffer buffer = ByteBuffer.allocate(arr.length);
        buffer.put(arr);//from w  w w.ja v  a 2 s  .c om
        buffer.flip();
        return buffer.duplicate();
    }
}

Related

  1. toBigDecimal(byte[] bytes, int scale)
  2. toBigInteger(byte[] bytes)
  3. toBinaryFloatingPoint(double source)
  4. toBinaryString(byte[] b)
  5. toBuffer(boolean[] src, int offset)
  6. toBuffer(byte[] arr)
  7. toBuffer(int[] array)
  8. toBuffer(Serializable obj)
  9. toBuffer(String spacedHex)