Java Integer to intToOneByte(int value)

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

Description

int To One Byte

License

Open Source License

Declaration

public static byte intToOneByte(int value) 

Method Source Code

//package com.java2s;

public class Main {
    private static final String ERR_VALUE_OOB = "Value out of bounds (%s)";
    public static final int MAX_8BITS = 255;

    public static byte intToOneByte(int value) {
        if ((value < 0) || (value > MAX_8BITS))
            throw new IllegalArgumentException(String.format(ERR_VALUE_OOB, value));

        return (byte) (value & 0xFF);
    }//from   ww w  .  j a  v a2s.  com
}

Related

  1. intToNetworkByteOrder(int num, int count)
  2. intToNumericFormat(int src)
  3. intToOctal(int value)
  4. IntToOctString(final int value)
  5. intToOneByte(int i)
  6. intToOneByteArray(int number)
  7. IntToPackage(int pack)
  8. intToPaddedString(int value, int pad)
  9. intToPercent(int value)