code: public int checkDiffNumber(double[] weight) {
          // Count the number of different weight
          double category[] = new double[weight.length];
          int i, j;
          int count = 1;
          double t;
          category[1] = weight[1];
          for (i = 2; i < weight.length; i++) {
              for (j = 1; j <= count; j++) {
                  t = weight[i] - category[j];
                  if (t < 0.0) t = -t;
                  if (t < LOST) break;
              }
              if (j > count) {
                  count += 1;
                  category[count] = weight[i];
              }
          }
          return count;
      }
docs: Get different number of the given number.
  
  @param weight array contains weight of the nodes
  @return number of different weight