Java Long Number Convert To fromLong(long d)

Here you can find the source of fromLong(long d)

Description

fromLong

License

Open Source License

Parameter

Parameter Description
d a long.

Return

a int.

Declaration

@Deprecated
public static int fromLong(long d) 

Method Source Code

//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;
    }
}

Related

  1. convertLongToCharSmall(long theLong)
  2. convertLongToCidr(long unsignedIntCidr)
  3. convertLongToDouble(final long[] longs)
  4. convertLongToInt(long l)
  5. convertLongToString(long value)
  6. fromLong(long input)
  7. fromLong(long key)
  8. fromLong(long longValue)
  9. fromLong(long v, int offset, byte[] dest)