Here you can find the source of div(long v1, long v2)
Parameter | Description |
---|---|
v1 | a parameter |
v2 | a parameter |
public static long div(long v1, long v2)
//package com.java2s; /**/*from w w w .j a v a2 s .com*/ * (C) 2011-2012 Alibaba Group Holding Limited. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * version 2 as published by the Free Software Foundation. * */ import java.math.BigDecimal; public class Main { /** * @param v1 * @param v2 * @return */ public static long div(long v1, long v2) { BigDecimal b1 = new BigDecimal(v1); BigDecimal b2 = new BigDecimal(v2); return b1.divide(b2, 0, BigDecimal.ROUND_HALF_UP).longValue(); } }