Enum LongMath.MillerRabinTester

    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      LARGE
      Works for all nonnegative signed longs.
      SMALL
      Works for inputs ≤ FLOOR_SQRT_MAX_LONG.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private MillerRabinTester()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) abstract long mulMod​(long a, long b, long m)
      Returns a * b mod m.
      private long powMod​(long a, long p, long m)
      Returns a^p mod m.
      (package private) abstract long squareMod​(long a, long m)
      Returns a^2 mod m.
      (package private) static boolean test​(long base, long n)  
      private boolean testWitness​(long base, long n)
      Returns true if n is a strong probable prime relative to the specified base.
      static LongMath.MillerRabinTester valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static LongMath.MillerRabinTester[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MillerRabinTester

        private MillerRabinTester()
    • Method Detail

      • values

        public static LongMath.MillerRabinTester[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (LongMath.MillerRabinTester c : LongMath.MillerRabinTester.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static LongMath.MillerRabinTester valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • test

        static boolean test​(long base,
                            long n)
      • mulMod

        abstract long mulMod​(long a,
                             long b,
                             long m)
        Returns a * b mod m.
      • squareMod

        abstract long squareMod​(long a,
                                long m)
        Returns a^2 mod m.
      • powMod

        private long powMod​(long a,
                            long p,
                            long m)
        Returns a^p mod m.
      • testWitness

        private boolean testWitness​(long base,
                                    long n)
        Returns true if n is a strong probable prime relative to the specified base.