import java.text.DecimalFormat; public class Work2_3 { public static void main(String[] args) { DecimalFormat f2 = new DecimalFormat("0.00"); double[] test1 = {3, 5, 4, 3, 1, 7}; double x = DoCal(test1, test1.length); System.out.println("x = " + f2.format(x)); // x = 3.833333 } //------------------------ private static double DoCal(double[] test, int size) { double s = 0; for(int i=0; i