code:     private static int getNumberOfIterations(int bits, int certainty)
      {
          /*
           * NOTE: We enforce a minimum 'certainty' of 100 for bits >= 1024 (else 80). Where the
           * certainty is higher than the FIPS 186-4 tables (C.2/C.3) cater to, extra iterations
           * are added at the "worst case rate" for the excess.
           */
          if (bits >= 1536)
          {
              return  certainty <= 100 ? 3
                  :   certainty <= 128 ? 4
                  :   4 + (certainty - 128 + 1) / 2;
          }
          else if (bits >= 1024)
          {
              return  certainty <= 100 ? 4
                  :   certainty <= 112 ? 5
                  :   5 + (certainty - 112 + 1) / 2;
          }
          else if (bits >= 512)
          {
              return  certainty <= 80  ? 5
                  :   certainty <= 100 ? 7
                  :   7 + (certainty - 100 + 1) / 2;
          }
          else
          {
              return  certainty <= 80  ? 40
                  :   40 + (certainty - 80 + 1) / 2;
          }
      }
  