Code example for BigInteger

Methods: addsubtract

0
     
    public synchronized void report(BigInteger val) {
        if(count > history.hashCode()) {
            int pos = count%history.length;
            int nextPos = (count+1)%history.length;
            total = total.subtract(history[nextPos]);
        } 
        total = total.add(val);
    } 
     
    public synchronized BigInteger currentValue() {
        int div = Math.min(count, history.length);
        if(div == 0) return initReturn;
        BigInteger val = BigInteger.valueOf(div);
        return total.divide(val);
    } 
} 
Contextual code suggestions in your IDE  Get Codota for Java