### Question:
IdentityByStateClustering { public int getCompoundIndex(int first, int second) { if (first >= second) { throw new IllegalArgumentException("first (" + first + ") and second (" + second + ") sample indexes, must comply with: 0 <= first < second"); } return (second*second - second)/2 + first; }  List<IdentityByState> countIBS(List<Variant> variants, List<String> samples); List<IdentityByState> countIBS(List<Variant> variants, List<String> samples,
                                          IBDExpectedFrequencies expectedFreqs); List<IdentityByState> countIBS(Variant variant, List<String> samples); List<IdentityByState> countIBS(Variant variant, List<String> samples, IBDExpectedFrequencies expectedFreqs); List<IdentityByState> countIBS(Iterator<Variant> iterator, List<String> samples); List<IdentityByState> countIBS(Iterator<Variant> iterator, List<String> samples,
                                          IBDExpectedFrequencies expectedFreqs); List<IdentityByState> initCounts(List<String> samples); void countIBS(Variant variant, List<String> samples, List<IdentityByState> counts); int countSharedAlleles(int allelesCount, Genotype genotypeFirst, Genotype genotypeSecond); int getAmountOfPairs(int samplesCount); int getCompoundIndex(int first, int second); int getSecondSampleIndex(int compoundIndex); int getFirstSampleIndex(int compoundIndex, int secondSampleIndex); void forEachPair(List<String> samples, SamplePairConsumer<E> loopBody); void write(OutputStream outputStream, List<IdentityByState> ibsList, List<String> samples); static final int MAX_SAMPLES_ALLOWED; }### Answer:
@Test public void testGetCompountIndex() throws Exception { IdentityByStateClustering ibsc = new IdentityByStateClustering(); assertEquals(0, ibsc.getCompoundIndex(0, 1)); assertEquals(1, ibsc.getCompoundIndex(0, 2)); assertEquals(2, ibsc.getCompoundIndex(1, 2)); assertEquals(3, ibsc.getCompoundIndex(0, 3)); assertEquals(6, ibsc.getCompoundIndex(0, 4)); assertEquals(10, ibsc.getCompoundIndex(0, 5)); }