Java Long Number Convert To convertLongToInt(long l)

Here you can find the source of convertLongToInt(long l)

Description

Convert a long value to an int value.

License

Apache License

Parameter

Parameter Description
l the value to convert

Return

the converted int value

Declaration

public static int convertLongToInt(long l) 

Method Source Code

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

public class Main {
    /**/*ww  w . j av a 2 s . c  o m*/
     * Convert a long value to an int value. Values larger than the biggest int
     * value is converted to the biggest int value, and values smaller than the
     * smallest int value are converted to the smallest int value.
     *
     * @param l the value to convert
     * @return the converted int value
     */
    public static int convertLongToInt(long l) {
        if (l <= Integer.MIN_VALUE) {
            return Integer.MIN_VALUE;
        } else if (l >= Integer.MAX_VALUE) {
            return Integer.MAX_VALUE;
        } else {
            return (int) l;
        }
    }
}

Related

  1. convertLongToBytes(final long unsignedIntIp)
  2. convertLongToBytes(long l)
  3. convertLongToCharSmall(long theLong)
  4. convertLongToCidr(long unsignedIntCidr)
  5. convertLongToDouble(final long[] longs)
  6. convertLongToString(long value)
  7. fromLong(long d)
  8. fromLong(long input)
  9. fromLong(long key)