Here you can find the source of fromLong(long d)
fromLong
Parameter | Description |
---|---|
d | a long. |
@Deprecated public static int fromLong(long d)
//package com.java2s; /**//from w w w . j a v a 2s .c o m * Copyright (C) 2011,2012 Gordon Fraser, Andrea Arcuri and EvoSuite * contributors * * This file is part of EvoSuite. * * EvoSuite is free software: you can redistribute it and/or modify it under the * terms of the GNU Public License as published by the Free Software Foundation, * either version 3 of the License, or (at your option) any later version. * * EvoSuite is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. See the GNU Public License for more details. * * You should have received a copy of the GNU Public License along with * EvoSuite. If not, see <http://www.gnu.org/licenses/>. */ public class Main { /** * <p> * fromLong * </p> * * @param d * a long. * @return a int. */ @Deprecated public static int fromLong(long d) { /* if (d > Integer.MAX_VALUE) return Integer.MAX_VALUE; else if (d < Integer.MIN_VALUE) return Integer.MIN_VALUE; */ //else // return (int) d; if (d == 0L) return 0; double d2 = Math.signum(d) * Math.abs(d) / (1L + Math.abs(d)); int d3 = (int) Math.round(Integer.MAX_VALUE * d2); return d3; } }