Java Integer to Byte Array intToByteArray(int value)

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

Description

int To Byte Array

License

Open Source License

Declaration

public static byte[] intToByteArray(int value) 

Method Source Code

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

public class Main {
    public static byte[] intToByteArray(int value) {
        try {// w  w  w.ja  v  a  2 s.c o m
            return new byte[] { (byte) (value >>> 24), (byte) (value >>> 16), (byte) (value >>> 8),
                    (byte) (value) };
        } catch (NullPointerException npe) {
            return null;
        }
    }
}

Related

  1. intToByteArray(int piValueToConvert, boolean pbBigEndian)
  2. intToByteArray(int pSrc, byte[] pDst, int pOffset)
  3. intToByteArray(int source)
  4. IntToByteArray(int val, byte[] buf, int offset)
  5. intToByteArray(int value)
  6. intToByteArray(int value)
  7. intToByteArray(int value)
  8. intToByteArray(int value)
  9. intToByteArray(int value)