Java Int to Byte Array UIntToByte2(int value)

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

Description

U Int To Byte

License

Open Source License

Declaration

public static byte[] UIntToByte2(int value) 

Method Source Code

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

public class Main {
    public static byte[] UIntToByte2(int value) {
        if (value < 0)
            value = 0;/*from w  w w.  java 2s  .  c  o m*/
        if (value > Short.MAX_VALUE)
            value = Short.MAX_VALUE;
        value += Short.MIN_VALUE;
        return new byte[] { (byte) (value >>> 8), (byte) value };
    }
}

Related

  1. intTobyte2(int i)
  2. intToByte2Array(int x)