Java Convert via ByteBuffer toIntArray(byte[] byteArray)

Here you can find the source of toIntArray(byte[] byteArray)

Description

Returns a new integer array using data from the given byte array.

License

Open Source License

Declaration

public static int[] toIntArray(byte[] byteArray) 

Method Source Code


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

import java.nio.ByteBuffer;
import java.nio.IntBuffer;

public class Main {
    /**/*  ww w  .j a  va  2 s  . c  om*/
     * Returns a new integer array using data from the given byte array.
     */
    public static int[] toIntArray(byte[] byteArray) {
        IntBuffer intBuffer = ByteBuffer.wrap(byteArray).asIntBuffer();
        int[] intArray = new int[intBuffer.limit()];
        intBuffer.get(intArray);
        return intArray;
    }
}

Related

  1. toInt(byte[] bytes)
  2. toInt(byte[] data)
  3. toInt(byte[] value)
  4. toInt(final byte lowOrderByte, final byte highOrderByte)
  5. toInt(InetAddress address)
  6. toIntArray(byte[] byteArray)
  7. toIntArray(final byte[] byteArray)
  8. toIntArray(float[] floatArray)
  9. toIntBuffer(int[] array)