Java Convert via ByteBuffer intToByteArray(int integer)

Here you can find the source of intToByteArray(int integer)

Description

int To Byte Array

License

Open Source License

Declaration

public static byte[] intToByteArray(int integer) 

Method Source Code


//package com.java2s;
import java.nio.ByteBuffer;

public class Main {
    public static byte[] intToByteArray(int integer) {
        ByteBuffer buf = ByteBuffer.allocate(4);
        buf.putInt(integer);/*www.j  a v a2 s.c o m*/
        return buf.array();
    }
}

Related

  1. intArrayToBytes(Collection values)
  2. intArrayToIntBuffer(int[] data)
  3. intsToBytes(int[] n)
  4. IntToBArray(int src)
  5. intToByte(int[] intArray)
  6. intToByteArray(int l)
  7. intToByteArray(int number)
  8. intToByteArray(int someInt, int byteSize)
  9. intToBytes(final int i)