public static Set<Integer> toSet(int[] replicas) {
        Set<Integer> result = new HashSet<>();
        for (int replica : replicas) {
            result.add(replica);
        }
        return result;
    }
@Test
    public void testToSet() {
        assertEquals(Collections.emptySet(), Replicas.toSet(new int[] {}));
        assertEquals(new HashSet<>(Arrays.asList(3, 1, 5)),
            Replicas.toSet(new int[] {1, 3, 5}));
        assertEquals(new HashSet<>(Arrays.asList(1, 2, 10)),
            Replicas.toSet(new int[] {1, 1, 2, 10, 10}));
    }