Java Long to Int longToInt(Long l)

Here you can find the source of longToInt(Long l)

Description

long To Int

License

Open Source License

Declaration

public static int longToInt(Long l) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 BSI Business Systems Integration AG.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors://from w w w. j  a v  a 2 s  .  c  om
 *     BSI Business Systems Integration AG - initial API and implementation
 ******************************************************************************/

public class Main {
    public static int longToInt(Long l) {
        if (l != null) {
            if (new Long(Integer.MAX_VALUE).compareTo(l) == -1) {
                return Integer.MAX_VALUE;
            } else if (new Long(Integer.MIN_VALUE).compareTo(l) == 1) {
                return Integer.MIN_VALUE;
            }
            return l.intValue();
        }
        return 0;
    }
}

Related

  1. long2int(Long source)
  2. longToInt(final Long l, final String name, final int deflt)
  3. longToInt(long d)
  4. longToInt(long l)
  5. longToInt(Long l)
  6. longToInt(long value)
  7. longToInt(long[] values)
  8. longToIntArr(long[] longArr)
  9. longToIntArray(long value)