A BitSel class creates a special type of array that holds bit values. This army can increase in size as needed. This makes it similar to a vector of bits. The BitSet constructors are shown here:

£bitSet(int size)
The first version creates a default object. The second version allows you to specify its initial size (that is, the number of bits that it can hold). All bits are initialized to zero. Bit Set implements The output from this program is shown here. When to String( )'converts a Bit Set object to its string equivalent, each set bit is represented by its bit position. Cleared bits are not shown


The Date class encapsulates the current date and time. Before beginning our examination of Date, it is important to point out that it has changed substantially from its original version defined by java 1.0. When Java 1.1 was released, many of the functions carried out by the original Dale class were moved into the Calendar and Date Format classes, and as a result, many of the original 1.0 Date methods were deprecated. Java 2 adds a few new methods to the time and date classes, but otherwise implements them in the same form as did 1.1. Since the deprecated 1,0 methods shall ld not be used for new code, they arc not described here. Date supports the following constructors:
Date( )
Date(long millisec)
The first constructor initializes the object with the current date and time. The second constructor accepts one argument that equals the number of milliseconds that have elapsed since midnight, January I, 1970. The Non Deprecated methods defined by Date are shown in Table 16-3. With the advent of Java 2, Date also implements the Comparable interface.

Share This