/** * Returns the next token as a {@code BigInteger} in the current radix. * This method may block for more input. * * @throws IllegalStateException * if this {@code Scanner} has been closed. * @throws NoSuchElementException * if input has been exhausted. * @throws InputMismatchException * if the next token can not be translated into a valid * {@code BigInteger}. */ public BigInteger nextBigInteger() { return nextBigInteger(currentRadix); }
int i = 0; while ( sc.hasNext() ) { result[i++] = sc.nextBigInteger().longValue();
Scanner sc = new Scanner(System.in); BigInteger bi = sc.nextBigInteger();
/** * Returns the next token as a {@code BigInteger} in the current radix. * This method may block for more input. * * @throws IllegalStateException if this {@code Scanner} has been closed. * @throws NoSuchElementException if input has been exhausted. * @throws InputMismatchException if the next token can not be translated into a valid * {@code BigInteger}. */ public BigInteger nextBigInteger() { return nextBigInteger(currentRadix); }
/** * Returns the next token as a {@code BigInteger} in the current radix. * This method may block for more input. * * @throws IllegalStateException * if this {@code Scanner} has been closed. * @throws NoSuchElementException * if input has been exhausted. * @throws InputMismatchException * if the next token can not be translated into a valid * {@code BigInteger}. */ public BigInteger nextBigInteger() { return nextBigInteger(currentRadix); }
/** * Returns the next token as a {@code BigInteger} in the current radix. * This method may block for more input. * * @throws IllegalStateException * if this {@code Scanner} has been closed. * @throws NoSuchElementException * if input has been exhausted. * @throws InputMismatchException * if the next token can not be translated into a valid * {@code BigInteger}. */ public BigInteger nextBigInteger() { return nextBigInteger(currentRadix); }
/** * Returns the next token as a {@code BigInteger} in the current radix. * This method may block for more input. * * @throws IllegalStateException * if this {@code Scanner} has been closed. * @throws NoSuchElementException * if input has been exhausted. * @throws InputMismatchException * if the next token can not be translated into a valid * {@code BigInteger}. */ public BigInteger nextBigInteger() { return nextBigInteger(currentRadix); }
/** * Returns the next token as a {@code BigInteger} in the current radix. * This method may block for more input. * * @throws IllegalStateException * if this {@code Scanner} has been closed. * @throws NoSuchElementException * if input has been exhausted. * @throws InputMismatchException * if the next token can not be translated into a valid * {@code BigInteger}. */ public BigInteger nextBigInteger() { return nextBigInteger(currentRadix); }
/** * Returns the next token as a {@code BigInteger} in the current radix. * This method may block for more input. * * @throws IllegalStateException * if this {@code Scanner} has been closed. * @throws NoSuchElementException * if input has been exhausted. * @throws InputMismatchException * if the next token can not be translated into a valid * {@code BigInteger}. */ public BigInteger nextBigInteger() { return nextBigInteger(currentRadix); }
Scanner scanner = new Scanner(fileOrOther); try{ BigInteger bigint = scanner.nextBigInteger(); } catch(NumberFormatException ex) { //handle Code here }
public static void main(String[] args) { BigInteger num; BigInteger fact = BigInteger.valueOf(1); Scanner input = new Scanner(System.in); System.out.println("Enter a number: "); num = input.nextBigInteger(); for (int i = 2; i <= num; i++){ fact = fact.multiply(BigInteger.valueOf(i)); } System.out.println(fact); }
public static void main(String[] args){ Scanner scan = new Scanner(System.in); BigInteger m = scan.nextBigInteger(); BigInteger n = scan.nextBigInteger(); BigInteger[] xor = new BigInteger[m.intValue()]; for (BigInteger i = BigInteger.valueOf(m.intValue()); i.compareTo(BigInteger.ZERO) > 0; i = i.subtract(BigInteger.ONE)) xor[i.intValue() - 1] = scan.nextBigInteger(); for (BigInteger i = BigInteger.valueOf(m.intValue()); i.compareTo(BigInteger.ZERO) > 0; i = i.subtract(BigInteger.ONE)) System.out.println(xor[i.intValue() - 1]); }
public static void main(String[] args) {// main method to test the nmbDigits method boolean exit=false; Scanner intInput = new Scanner(System.in); while (!exit) { try{ System.out.println("Input an integer number:"); BigInteger number = intInput.nextBigInteger() ; System.out.println(nmbDigits(number)); exit=true; } catch (InputMismatchException ex){ System.out.println("incorrect input, integer values only."); } } }
public class Prime { public static void main(String[] args){ long start = System.nanoTime(); System.out.println("enter a number:"); Scanner scanner = new Scanner(System.in); BigInteger bigInt = scanner.nextBigInteger(); boolean prime = bigInt.isProbablePrime(10); System.out.println(prime); } }
import java.math.BigInteger; import java.util.Scanner; public class ModuloTest { public static void main(String[] args) { String s; BigInteger n, repeat, remainder; Scanner in = new Scanner(System.in); s = in.nextLine(); n = in.nextBigInteger(); BigInteger length = BigInteger.valueOf(s.length()); repeat = n.divide(length); System.out.println(repeat); } }
@Nonnull @Override public BigInteger scanBigInt() { return getHandle().nextBigInteger(); }
@Nonnull @Override public BigInteger scanBigInt() { return getHandle().nextBigInteger(); }
Scanner sc = new Scanner(System.in); while (sc.hasNextBigInteger()) { a = sc.nextBigInteger(); }
public static void main(String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); BigInteger[] numberOnBalls = new BigInteger[T]; for (int i = 0; i < T; i++) { numberOnBalls[i] = in.nextBigInteger(); } System.out.println("" + priceOfPhone(numberOnBalls)); in.close(); } }
public static void main(String[] args) { Scanner in = new Scanner(System.in); computeFactorials(); int numberOfTestCases = in.nextInt(); for (int i = 0; i < numberOfTestCases; i++) { BigInteger p = in.nextBigInteger(); BigInteger q = in.nextBigInteger(); BigInteger result = binomialCoefficient(q, p); System.out.println(result); } }