public void testUShort() {
    final short[][] values =
        new short[][] {
          TestHelper.createUShorts(
              new int[] {32764, 32765, 32766, 32767, 32768, 32769, 32770, 32771}),
          TestHelper.createUShorts(new int[] {32765, 32767, 32769, 32771}),
          TestHelper.createUShorts(new int[] {32767, 32768, 32769})
        };
    final boolean unsigned = true;

    final Histogram histogram = new Histogram(new int[6], 32765, 32770);
    for (int i = 0; i < values.length; i++) {
      histogram.aggregate(values[i], unsigned, IndexValidator.TRUE, ProgressMonitor.NULL);
    }

    final int[] exp = new int[] {2, 1, 3, 2, 3, 1};
    assertEquals("", equal(exp, histogram.getBinCounts()));
  }
  public void testUShort_withValidator() {
    final short[][] values =
        new short[][] {
          TestHelper.createUShorts(
              new int[] {32764, 32765, 32766, 32767, 32768, 32769, 32770, 32771}),
          TestHelper.createUShorts(new int[] {32765, 32767, 32769, 32771}),
          TestHelper.createUShorts(new int[] {32767, 32768, 32769})
        };
    final boolean unsigned = true;
    final IndexValidator validator =
        new IndexValidator() {
          public boolean validateIndex(int index) {
            return index % 3 != 0;
          }
        };

    final Histogram histogram = new Histogram(new int[6], 32765, 32770);
    for (int i = 0; i < values.length; i++) {
      histogram.aggregate(values[i], unsigned, validator, ProgressMonitor.NULL);
    }

    final int[] exp = new int[] {1, 1, 1, 2, 3, 0};
    assertEquals("", equal(exp, histogram.getBinCounts()));
  }