Android Int to Byte Array Convert intToBytes(int number)

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

Description

int To Bytes

Declaration

public static byte[] intToBytes(int number) 

Method Source Code

//package com.java2s;

public class Main {

    public static byte[] intToBytes(int number) {
        return new byte[] { (byte) ((number >> 24) & 0xFF),
                (byte) ((number >> 16) & 0xFF),
                (byte) ((number >> 8) & 0xFF), (byte) (number & 0xFF) };
    }/*  ww w. j a  v a2s  . com*/
}

Related

  1. intToByteArray(int i)
  2. intToByteArray(int value)
  3. intToBytes(int i)
  4. intToBytes(int in)
  5. intToBytes(int n)
  6. intToBytes(int x)
  7. toBytes(int value)
  8. toBytes(int value, byte[] dest, int destPos)
  9. getBytes(int data)