Java Integer to Byte Array int2bytes(int num, int len)

Here you can find the source of int2bytes(int num, int len)

Description

intbytes

License

Open Source License

Declaration

public static byte[] int2bytes(int num, int len) 

Method Source Code

//package com.java2s;

public class Main {

    public static byte[] int2bytes(int num, int len) {
        byte[] b = new byte[len];
        for (int i = 0; i < len; i++) {
            b[i] = (byte) (num >>> ((len - 1 - i) * 8));
        }/*from   w w w. j a v  a  2s .c o  m*/
        return b;
    }
}

Related

  1. int2Bytes(int n, byte[] dst, int start)
  2. int2Bytes(int num)
  3. int2bytes(int num)
  4. int2Bytes(int num)
  5. int2bytes(int num)
  6. int2bytes(int v)
  7. int2bytes(int val, byte[] bytes, int offset, boolean bigEndian)
  8. int2bytes(int value)
  9. int2bytes(int value)