### Question:
Information { public static double entropy(int[] counts) { double entropy = 0.0; int total = 0; for (int count : counts) { if (count > 1) { entropy -= count * Math.log(count); } total += count; } return entropy / total + Math.log(total); } private  Information(); static Pair<Decision,Double> bestGain(Iterable<Decision> decisions, ExampleSet examples); static double entropy(int[] counts);  }### Answer:
@Test public void testEmptyInformation() { assertNaN(Information.entropy(new int[] {})); }
@Test public void testEmptyClassInformation() { assertNaN(Information.entropy(new int[] {0})); }
@Test public void testOneClassInformation() { assertEquals(0.0, Information.entropy(new int[] {1})); }
@Test public void testTwoEqualClassInformation() { assertEquals(Math.log(2.0), Information.entropy(new int[] {1, 1})); }
@Test public void testTwoUnequalClassInformation() { assertEquals(0.5623351446188083, Information.entropy(new int[] {2, 6})); }