sergAccount

Untitled

Feb 6th, 2021
436
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package com.mycompany.app8_dz;
  7.  
  8. import java.util.concurrent.Callable;
  9.  
  10. public class AvgTask implements Callable<Double>{
  11.     private int[] array;
  12.    
  13.     public AvgTask(int[] array){
  14.         this.array = array;
  15.     }
  16.     // выполняем вычисление на основе массива array и возвращаем значение Double
  17.     @Override
  18.     public Double call() throws Exception {
  19.         double res = 0;
  20.         for (int i = 0; i < array.length; i++) {
  21.             res += array[i];            
  22.         }
  23.         return res / array.length;
  24.     }        
  25. }
  26.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×