Code example for BitSet

Methods: sizetoString

     * @tests java.util.BitSet#BitSet(int) 
    public void test_ConstructorI() { 
        BitSet bs = new BitSet(128);
        assertEquals("Create BitSet of incorrect size", 128, bs.size());
        assertEquals("New BitSet had invalid string representation: "
                + bs.toString(), "{}", bs.toString());
        // All BitSets are created with elements of multiples of 64 
        bs = new BitSet(89);
        assertEquals("Failed to round BitSet element size", 128, bs.size());
        try { 
            bs = new BitSet(-9);
            fail("Failed to throw exception when creating a new BitSet with negative element value");
        } catch (NegativeArraySizeException e) {
            // Correct behaviour 
Stop searching for code, let great code find you!  Add Codota to your java IDE