Java Integer to Byte Array intToByteArray(int value)

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

Description

int To Byte Array

License

Apache License

Parameter

Parameter Description
value a parameter

Declaration

public static byte[] intToByteArray(int value) 

Method Source Code

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

public class Main {
    /**//from  w w  w  . j ava2s .c  o  m
     *
     * @param value
     * @return
     */
    public static byte[] intToByteArray(int value) {
        byte[] result = new byte[4];
        result[3] = (byte) (value >>> 24);
        result[2] = (byte) (value >>> 16);
        result[1] = (byte) (value >>> 8);
        result[0] = (byte) value;
        return result;
    }
}

Related

  1. intToByteArray(int value)
  2. intToByteArray(int value)
  3. intToByteArray(int value)
  4. intToByteArray(int value)
  5. intToByteArray(int value)
  6. intToByteArray(int value)
  7. intToByteArray(int value)
  8. intToByteArray(int value, byte[] buffer, int offset)
  9. intToByteArray(int value, byte[] data, int offset)