Java Integer to Byte Array intToBytesBE(int value, byte[] buffer)

Here you can find the source of intToBytesBE(int value, byte[] buffer)

Description

int To Bytes BE

License

Open Source License

Declaration

public static void intToBytesBE(int value, byte[] buffer) 

Method Source Code

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

public class Main {
    public static void intToBytesBE(int value, byte[] buffer) {
        intToBytesBE(value, buffer, 0, buffer.length);
    }//from  www  .ja v a 2s .c  o  m

    public static void intToBytesBE(int value, byte[] buffer, int offset, int length) {
        for (int i = offset + length - 1; i >= offset; --i) {
            buffer[i] = (byte) value;
            value >>>= 8;
        }
    }
}

Related

  1. intToBytes(int value, byte[] array, int offset)
  2. intToBytes(int value, byte[] buffer, int offset)
  3. intToBytes(int value, byte[] buffer, int offset, int length, boolean littleEndian)
  4. intToBytes16(int sample, byte[] buffer, int byteOffset, boolean bigEndian)
  5. IntToBytes4(int i)
  6. intToBytesBigend(int value)
  7. intToBytesBigEndian(int n)
  8. IntToBytesLE(final long val)
  9. intToBytesLE(int i, byte[] bytes, int off)