Java Integer to Byte Array intToByteArray(final int v, final byte[] buf, final int offset)

Here you can find the source of intToByteArray(final int v, final byte[] buf, final int offset)

Description

int To Byte Array

License

Apache License

Declaration

public static final void intToByteArray(final int v, final byte[] buf, final int offset) 

Method Source Code

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

public class Main {
    public static final void intToByteArray(final int v, final byte[] buf, final int offset) {
        buf[offset + 0] = (byte) ((v >> 24) & 0xFF);
        buf[offset + 1] = (byte) ((v >> 16) & 0xFF);
        buf[offset + 2] = (byte) ((v >> 8) & 0xFF);
        buf[offset + 3] = (byte) ((v >> 0) & 0xFF);
    }/* www .j ava 2  s. c o m*/
}

Related

  1. intTo4ByteArray(int value)
  2. intTo4Bytes(int i)
  3. intToByteArray(byte[] bytes, int i)
  4. intToByteArray(final int integer)
  5. intToByteArray(final int integer)
  6. intToByteArray(final int val, final byte[] buf, final int offset)
  7. intToByteArray(final int value)
  8. intToByteArray(final int x)
  9. intToByteArray(final int x, final byte[] dst, final int offset)