public void test_ringnestring() throws Exception {
    System.out.println("Testing identity ring2nest(nest2ring(i))==i");
    Random rng = new Random(5);

    for (int o = 0; o <= HealpixBase.order_max; ++o) {
      for (int m = 0; m < nsamples; ++m) {
        long pix = (long) (rng.nextDouble() * HealpixProc.order2Npix(o));
        assertEquals(
            "ringnestring problem", HealpixProc.ring2nest(o, HealpixProc.nest2ring(o, pix)), pix);
      }
    }
  }
 public void test() throws Exception {
   int o = 8;
   for (int i = 0; i < HealpixProc.order2Npix(o); ++i) {
     assertEquals(
         "pixel mismatch_nest", i, HealpixProc.ang2pixNest(o, HealpixProc.pix2angNest(o, i)));
     assertEquals(
         "pixel mismatch_nest", i, HealpixProc.vec2pixNest(o, HealpixProc.pix2vecNest(o, i)));
     assertEquals(
         "pixel mismatch_ring", i, HealpixProc.ang2pixRing(o, HealpixProc.pix2angRing(o, i)));
     assertEquals(
         "pixel mismatch_ring", i, HealpixProc.vec2pixRing(o, HealpixProc.pix2vecRing(o, i)));
     assertEquals(
         "pixel mismatch",
         i,
         HealpixProc.ring2nest(o, HealpixProc.ang2pixRing(o, HealpixProc.pix2angNest(o, i))));
     assertEquals(
         "pixel mismatch_ringnestring", i, HealpixProc.ring2nest(o, HealpixProc.nest2ring(o, i)));
   }
 }