Java Integer Create toInt(final long a)

Here you can find the source of toInt(final long a)

Description

to Int

License

Open Source License

Parameter

Parameter Description
a A long value.

Return

The closest int value in [Integer.MIN_VALUE,Integer.MAX_VALUE] range.

Declaration

public static int toInt(final long a) 

Method Source Code

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

public class Main {
    /**/*  w w  w.j  av a 2 s .c o  m*/
     * @param a
     *            A long value.
     * @return The closest int value in [Integer.MIN_VALUE,Integer.MAX_VALUE] range.
     */
    public static int toInt(final long a) {
        if (a != (int) a) {
            return a < 0 ? Integer.MIN_VALUE : Integer.MAX_VALUE;
        }
        return (int) a;
    }
}

Related

  1. toInt(final byte[] inputBytes, int offset)
  2. toInt(final byte[] pBytes)
  3. toInt(final Double value)
  4. toInt(final double[] a, final int len)
  5. toInt(final int r, final int g, final int b)
  6. toInt(final long n)
  7. toInt(final Object obj)
  8. toInt(final Object valueRep)
  9. toInt(final String s)