SHARE
TWEET

Untitled

a guest Oct 10th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static double median(ArrayList<Double> array) {
  2.         Collections.sort(array);
  3.  
  4.         if (array.size() % 2 == 0) {
  5.             return (array.get((array.size() / 2) - 1) + array.get(array.size() / 2)) / 2;
  6.         } else {
  7.             return array.get(array.size() / 2);
  8.         }
  9.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top