< prev index next >

test/java/lang/Long/BitTwiddle.java

Print this page
rev 17324 : 8181759: add explicit @build actions for jdk.test.lib classes in all :tier1 tests
Reviewed-by: duke


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @library /test/lib

  27  * @run main BitTwiddle
  28  * @bug     4495754 8078672
  29  * @summary Basic test for long bit twiddling (use -Dseed=X to set PRNG seed)
  30  * @author  Josh Bloch
  31  * @key randomness
  32  */
  33 
  34 import java.util.Random;
  35 import jdk.test.lib.RandomFactory;
  36 import static java.lang.Long.*;
  37 
  38 public class BitTwiddle {
  39     private static final int N = 1000; // # of repetitions per test
  40 
  41     public static void main(String args[]) {
  42         Random rnd = RandomFactory.getRandom();
  43 
  44         if (highestOneBit(0) != 0)
  45             throw new RuntimeException("a");
  46         if (highestOneBit(-1) != MIN_VALUE)




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test
  26  * @library /test/lib
  27  * @build jdk.test.lib.RandomFactory
  28  * @run main BitTwiddle
  29  * @bug     4495754 8078672
  30  * @summary Basic test for long bit twiddling (use -Dseed=X to set PRNG seed)
  31  * @author  Josh Bloch
  32  * @key randomness
  33  */
  34 
  35 import java.util.Random;
  36 import jdk.test.lib.RandomFactory;
  37 import static java.lang.Long.*;
  38 
  39 public class BitTwiddle {
  40     private static final int N = 1000; // # of repetitions per test
  41 
  42     public static void main(String args[]) {
  43         Random rnd = RandomFactory.getRandom();
  44 
  45         if (highestOneBit(0) != 0)
  46             throw new RuntimeException("a");
  47         if (highestOneBit(-1) != MIN_VALUE)


< prev index next >