Java Integer to int2minBeb(final int x)

Here you can find the source of int2minBeb(final int x)

Description

intmin Beb

License

Apache License

Declaration

public static byte[] int2minBeb(final int x) throws IllegalArgumentException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static byte[] int2minBeb(final int x) throws IllegalArgumentException {
        if (x <= 0xFFFF) {
            if (x <= 0xFF) {
                if (x < 0)
                    throw new IllegalArgumentException();
                return new byte[] { (byte) x };
            }//from  w w w . jav  a  2  s  .c o  m
            return new byte[] { (byte) (x >> 8), (byte) x };
        }
        if (x <= 0xFFFFFF)
            return new byte[] { (byte) (x >> 16), (byte) (x >> 8), (byte) x };
        return new byte[] { (byte) (x >> 24), (byte) (x >> 16), (byte) (x >> 8), (byte) x };
    }
}

Related

  1. int2ddouble(final int i)
  2. int2double(int[] ia)
  3. int2EyptStr(int num)
  4. int2float(Integer integer)
  5. int2Integer(int[] array)
  6. int2path(int v)
  7. int2rgb(final int color)
  8. Int2Short(int i)
  9. int2sortableStr(int val)