code: public static double mode(double[] values) {
          if (values.length == 0)
              throw new IllegalArgumentException("No mode in an empty array");        
          Counter<Double> c = new ObjectCounter<Double>();
          for (double d : values)
              c.count(d);
          return c.max();
      }
docs: Returns the mode value of the array of doubles