Here you can find the source of longToInt(Long l)
public static int longToInt(Long l)
//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; } }