Java BitSet set() methodThe set() method of Java BitSet class is used to set the bit value to true at the specified index. There are various overloaded set() method available in BitSet class. These methods are differentiated on the basis of their parameters. Syntax:Parameter:
Returns:NA Exception:This method throws IndexOutOfBoundsException if any of the following statements became true:
Compatibility Version:
Example of Java BitSet set(int bitIndex) methodExample 1Output: true bit value at index: {0, 2, 3, 5, 6} Example of Java BitSet set(int bitIndex, boolean value) methodExample 2Output: true bit value at index: {0, 1, 5} Example of Java BitSet set(int fromIndex, int toIndex) methodExample 3Output: true bit value at index: {0, 1, 4, 7, 8} Example of Java BitSet set(int fromIndex, int toIndex, boolean value) methodExample 3Output: true bit value at index: {0, 1, 4, 10, 11} Next TopicJava-bitset-previoussetbit-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India