public static double calculateForChars(String input) {
        final Map<Character, Long> charCountMap = input.chars()
                .mapToObj(c -> (char) c)
                .collect(Collectors.groupingBy(p -> p, Collectors.counting()));

        double result = 0;
        for (Character c : charCountMap.keySet()) {
            double probabilityForChar = (double) charCountMap.get(c) / input.length();
            result += probabilityForChar * logBaseTwo(1 / probabilityForChar);
        }
        return result;
    }
@Test
    public void testEntropyCalcForChars() {
        assertEquals(0D, ShannonEntropy.calculateForChars("1111"));
        assertEquals(0D, ShannonEntropy.calculateForChars("5555555555"), 0.0D);
        assertEquals(0D, ShannonEntropy.calculateForChars("5555555555"), 0.0D);
        assertEquals(0.46899559358928133D, ShannonEntropy.calculateForChars("1555555555"));
        assertEquals(1.0D, ShannonEntropy.calculateForChars("1111155555"));
        assertEquals(3.3219280948873635D, ShannonEntropy.calculateForChars("1234567890"));
        assertEquals(5.1699250014423095D, ShannonEntropy.calculateForChars("1234567890qwertyuiopasdfghjklzxcvbnm"));
    }