Java Integer to Byte Array intToByteArray(int integer)

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

Description

int To Byte Array

License

Open Source License

Declaration

public static byte[] intToByteArray(int integer) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static byte[] intToByteArray(int integer) {
        return new byte[] { (byte) ((integer & 0xFF000000) >> 24),
                (byte) ((integer & 0x00FF0000) >> 16),
                (byte) ((integer & 0x0000FF00) >> 8),
                (byte) ((integer & 0x000000FF)) };
    }//from w  w w  . j a  v  a  2s .  c  o m
}

Related

  1. intToByteArray(int bytes)
  2. intToByteArray(int data)
  3. intToByteArray(int i)
  4. intToByteArray(int i)
  5. intToByteArray(int input)
  6. intToByteArray(int integer)
  7. intToByteArray(int piValueToConvert, boolean pbBigEndian)
  8. intToByteArray(int pSrc, byte[] pDst, int pOffset)
  9. intToByteArray(int source)