Java Integer to Byte Array intToBytes(int intValue)

Here you can find the source of intToBytes(int intValue)

Description

int To Bytes

License

Apache License

Declaration

public static byte[] intToBytes(int intValue) 

Method Source Code

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

public class Main {

    public static byte[] intToBytes(int intValue) {
        byte[] b = new byte[4];
        for (int i = 0; i < 4; i++) {
            b[i] = (byte) (intValue >> 8 * (3 - i) & 0xFF);
        }//www.j a v a  2 s .  c  om
        return b;
    }
}

Related

  1. intToBytes(int i)
  2. IntToBytes(int i)
  3. intToBytes(int i)
  4. intToBytes(int i, byte[] data, int[] offset)
  5. intToBytes(int i_)
  6. intToBytes(int ipInt)
  7. intToBytes(int n)
  8. intToBytes(int n)
  9. intToBytes(int num, byte[] arr, int pos)