2362N/A * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * A packed array of booleans. 0N/A * @author Joshua Bloch 0N/A * @author Douglas Hoover 0N/A private static int position(
int idx) {
// bits big-endian in each unit 0N/A * Creates a BitArray of the specified size, initialized to zeros. 0N/A * Creates a BitArray of the specified size, initialized from the 0N/A * specified byte array. The most significant bit of a[0] gets 0N/A * index zero in the BitArray. The array a must be large enough 0N/A * to specify a value for every bit in the BitArray. In other words, 0N/A * 8*a.length <= length. 0N/A "bit array of given length");
0N/A normalize the representation: 0N/A 1. discard extra bytes 0N/A 2. zero out extra bits in the last byte 0N/A * Create a BitArray whose bits are those of the given array 0N/A * Copy constructor (for cloning). 0N/A * Returns the indexed bit in this BitArray. 0N/A * Sets the indexed bit in this BitArray. 0N/A * Returns the length of this BitArray. 0N/A * Returns a Byte array containing the contents of this BitArray. 0N/A * The bit stored at index zero in this BitArray will be copied 0N/A * into the most significant bit of the zeroth element of the 0N/A * returned byte array. The last byte of the returned byte array 0N/A * will be contain zeros in any bits that do not have corresponding 0N/A * bits in the BitArray. (This matters only if the BitArray's size 0N/A * is not a multiple of 8.) 0N/A * Return a boolean array with the same bit values a this BitArray. 0N/A * Returns a hash code value for this bit array. 0N/A * @return a hash code value for this bit array. 0N/A { (
byte)
'0',(
byte)
'0',(
byte)
'0',(
byte)
'0'},
0N/A { (
byte)
'0',(
byte)
'0',(
byte)
'0',(
byte)
'1'},
0N/A { (
byte)
'0',(
byte)
'0',(
byte)
'1',(
byte)
'0'},
0N/A { (
byte)
'0',(
byte)
'0',(
byte)
'1',(
byte)
'1'},
0N/A { (
byte)
'0',(
byte)
'1',(
byte)
'0',(
byte)
'0'},
0N/A { (
byte)
'0',(
byte)
'1',(
byte)
'0',(
byte)
'1'},
0N/A { (
byte)
'0',(
byte)
'1',(
byte)
'1',(
byte)
'0'},
0N/A { (
byte)
'0',(
byte)
'1',(
byte)
'1',(
byte)
'1'},
0N/A { (
byte)
'1',(
byte)
'0',(
byte)
'0',(
byte)
'0'},
0N/A { (
byte)
'1',(
byte)
'0',(
byte)
'0',(
byte)
'1'},
0N/A { (
byte)
'1',(
byte)
'0',(
byte)
'1',(
byte)
'0'},
0N/A { (
byte)
'1',(
byte)
'0',(
byte)
'1',(
byte)
'1'},
0N/A { (
byte)
'1',(
byte)
'1',(
byte)
'0',(
byte)
'0'},
0N/A { (
byte)
'1',(
byte)
'1',(
byte)
'0',(
byte)
'1'},
0N/A { (
byte)
'1',(
byte)
'1',(
byte)
'1',(
byte)
'0'},
0N/A { (
byte)
'1',(
byte)
'1',(
byte)
'1',(
byte)
'1'}
0N/A * Returns a string representation of this BitArray. 0N/A // in last byte of repn, use only the valid bits