//------------------------------------------------------------------------- /* * Method: ToInteger(MyBigInteger n); * * It returns an integer representing * the digits stored in the input * parameter in Little - Endian * representation. */ private static int ToInteger(MyBigInteger n) { int result = 0; int length = n.value.Length; if (length > 31) { throw new Exception("ToInteger: length exceeded!"); } for (int i = 0; i < length; i++) { result += n.value[i] * (int)Math.Pow(10, i); } return(result); }
//------------------------------------------------------------------------- /* Method: ToInteger(MyBigInteger n); It returns an integer representing the digits stored in the input parameter in Little - Endian representation. */ private static int ToInteger(MyBigInteger n) { int result = 0; int length = n.value.Length; if (length > 31) { throw new ArgumentException(); } for (int i = 0; i < length; i++) { result += n.value[i] * (int) Math.Pow(10, i); } return result; }