Android Int to Byte Array Convert intToByte(int number)

Here you can find the source of intToByte(int number)

Description

int To Byte

Declaration

public static byte[] intToByte(int number) 

Method Source Code

//package com.java2s;

public class Main {
    public static byte[] intToByte(int number) {
        int temp = number;
        byte[] b = new byte[4];
        for (int i = 0; i < b.length; i++) {
            b[i] = new Integer(temp & 0xff).byteValue();
            temp = temp >> 8;/*w ww  . j  a  v a2 s.  c  o  m*/
        }
        return b;
    }
}

Related

  1. int2bytesBE(int val, byte[] b, int off)
  2. int2bytesLE(int val, byte[] b, int off)
  3. int2hex(int i)
  4. intFitsIn(final int value)
  5. intForByte(byte b)
  6. intToByteArray(int a)
  7. intToByteArray(int i)
  8. intToByteArray(int value)
  9. intToBytes(int i)