Java Integer to Byte intToByte(int number)

Here you can find the source of intToByte(int number)

Description

Converts a int to a byte.

License

Open Source License

Parameter

Parameter Description
number int number

Return

byte of the int

Declaration

public static byte intToByte(int number) 

Method Source Code

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

public class Main {
    /**/*from w  w w .  ja v  a  2s. c  o  m*/
     * Converts a int to a byte.
     *
     * @param number int number
     * @return byte of the int
     */
    public static byte intToByte(int number) {
        if (number <= 255 && number > 0)
            return (byte) number;
        else
            return Byte.MIN_VALUE;
    }
}

Related

  1. intToByte(int i)
  2. intToByte(int i)
  3. intToByte(int i_Value)
  4. intToByte(int myInt)
  5. intToByte(int num)
  6. intToByte(int number)
  7. intToByte(int number, int byteLength)
  8. intToByte(int v, byte[] dest)
  9. intToByte(int value)