Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.app8_dz;
- import java.util.concurrent.Callable;
- public class AvgTask implements Callable<Double>{
- private int[] array;
- public AvgTask(int[] array){
- this.array = array;
- }
- // выполняем вычисление на основе массива array и возвращаем значение Double
- @Override
- public Double call() throws Exception {
- double res = 0;
- for (int i = 0; i < array.length; i++) {
- res += array[i];
- }
- return res / array.length;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement