Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.math.BigDecimal;

public class Main {
    public static double[] round2(double[] doubleRes) {
        double[] result = new double[doubleRes.length];
        for (int i = 0; i < doubleRes.length; i++) {
            BigDecimal bg = new BigDecimal(doubleRes[i]);
            result[i] = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
        }
        return result;
    }
}