Java Long Number Divide div(long dividend, long divisor)

Here you can find the source of div(long dividend, long divisor)

Description

div

License

Open Source License

Declaration

private static long div(long dividend, long divisor) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2004-2010 Sunil Kamath (IcemanK).
 * All rights reserved.// w  w w . j a v  a  2  s  .  c o m
 * This program is made available under the terms of the Common Public License
 * v1.0 which is available at http://www.eclipse.org/legal/cpl-v10.html
 *
 * Contributors:
 *     Sunil Kamath (IcemanK) - initial API and implementation
 *******************************************************************************/

public class Main {
    private static long div(long dividend, long divisor) {
        if (dividend < 0) {
            return Math.round((double) (dividend - divisor + 1) / (double) divisor);
        }
        return Math.round((double) dividend / (double) divisor);
    }
}

Related

  1. div100(Long input)
  2. div_ceil(long n, long d)
  3. divCeil(long a, long b)
  4. divide(final long dividend, final long divisor)