Android Int to Byte Array Convert intToByteArray(int i)

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

Description

int To Byte Array

Declaration

public static byte[] intToByteArray(int i) 

Method Source Code

//package com.java2s;

public class Main {
    public static byte[] intToByteArray(int i) {
        byte[] result = new byte[4];
        result[0] = (byte) ((i >> 24) & 0xFF);
        result[1] = (byte) ((i >> 16) & 0xFF);
        result[2] = (byte) ((i >> 8) & 0xFF);
        result[3] = (byte) (i & 0xFF);
        return result;
    }/*from   ww w.jav  a2s.  c o  m*/
}

Related

  1. int2hex(int i)
  2. intFitsIn(final int value)
  3. intForByte(byte b)
  4. intToByte(int number)
  5. intToByteArray(int a)
  6. intToByteArray(int value)
  7. intToBytes(int i)
  8. intToBytes(int in)
  9. intToBytes(int n)