/** * Returns whether the next token can be translated into a valid * {@code long} value in the default radix. * * @return {@code true} if the next token can be translated into a valid * {@code long} value, otherwise {@code false}. * @throws IllegalStateException * if the {@code Scanner} has been closed. */ public boolean hasNextLong() { return hasNextLong(currentRadix); }
Scanner sc = new Scanner(System.in); while (!sc.hasNext("exit")) { System.out.println( sc.hasNextInt() ? "(int) " + sc.nextInt() : sc.hasNextLong() ? "(long) " + sc.nextLong() : sc.hasNextDouble() ? "(double) " + sc.nextDouble() : sc.hasNextBoolean() ? "(boolean) " + sc.nextBoolean() : "(String) " + sc.next() ); }
@Signature(@Arg(value = "radix", optional = @Optional("null"))) public Memory hasNextInt(Environment env, Memory... args) { return (args[0].isNull() ? scanner.hasNextLong() : scanner.hasNextInt(args[0].toInteger())) ? Memory.TRUE : Memory.FALSE; }
switch (nonNillOutput.getType()) { case LONG: if (scanner.hasNextLong()) { return scanner.nextLong(); } else {
/** * To long. * * @param num the num * @param defaultValue the default value * @return the long */ public static long toLong(String num, long defaultValue) { if (num != null && !num.contains(" ")) { try (Scanner scanner = new Scanner(num)) { if (scanner.hasNextLong()) { return Long.parseLong(num); } } } return defaultValue; }
if (sc.hasNextLong()) { cachedDfsUsed = sc.nextLong(); } else { if (sc.hasNextLong()) { mtime = sc.nextLong(); } else {
/** * Returns whether the next token can be translated into a valid * {@code long} value in the default radix. * * @return {@code true} if the next token can be translated into a valid * {@code long} value, otherwise {@code false}. * @throws IllegalStateException * if the {@code Scanner} has been closed. */ public boolean hasNextLong() { return hasNextLong(currentRadix); }
/** * Returns whether the next token can be translated into a valid * {@code long} value in the default radix. * * @return {@code true} if the next token can be translated into a valid * {@code long} value, otherwise {@code false}. * @throws IllegalStateException * if the {@code Scanner} has been closed. */ public boolean hasNextLong() { return hasNextLong(currentRadix); }
/** * Returns whether the next token can be translated into a valid * {@code long} value in the default radix. * * @return {@code true} if the next token can be translated into a valid * {@code long} value, otherwise {@code false}. * @throws IllegalStateException * if the {@code Scanner} has been closed. */ public boolean hasNextLong() { return hasNextLong(currentRadix); }
/** * Returns whether the next token can be translated into a valid * {@code long} value in the default radix. * * @return {@code true} if the next token can be translated into a valid * {@code long} value, otherwise {@code false}. * @throws IllegalStateException * if the {@code Scanner} has been closed. */ public boolean hasNextLong() { return hasNextLong(currentRadix); }
/** * Returns whether the next token can be translated into a valid * {@code long} value in the default radix. * * @return {@code true} if the next token can be translated into a valid * {@code long} value, otherwise {@code false}. * @throws IllegalStateException * if the {@code Scanner} has been closed. */ public boolean hasNextLong() { return hasNextLong(currentRadix); }
/** * Returns whether the next token can be translated into a valid * {@code long} value in the default radix. * * @return {@code true} if the next token can be translated into a valid * {@code long} value, otherwise {@code false}. * @throws IllegalStateException * if the {@code Scanner} has been closed. */ public boolean hasNextLong() { return hasNextLong(currentRadix); }
File file = new File("contactids.txt"); Scanner scanner = new Scanner(file); while(scanner.hasNextLong()) { // Read values here like long input = scanner.nextLong(); }
sc = new Scanner(restartMeta, "UTF-8"); if (sc.hasNextLong() && (sc.nextLong() > timer.now())) {
Scanner sc = new Scanner(s); if (sc.hasNextLong()) { long num = sc.nextLong(); }
Scanner scanner = new Scanner(new File(fileLocation)); while (scanner.hasNextLong()) { currentNum = scanner.nextLong(); }
Scanner input = Scanner(System.in); System.out.printline("Enter some numbers: "); String line = scanner.nextLine(); Scanner lineScanner = new Scanner(line); while (lineScanner.hasNextLong()){ long num = lineScanner.nextLong(); // do something with num }
public static void main(String[] args) { String a = "0700"; Scanner s = new Scanner(a); while (s.hasNextLong(8)) { //make sure the number can be parsed as an octal System.out.print(s.nextLong(8)); //read as an octal value } }
long val; Scanner sc=new Scanner(System.in); while (sc.hasNextLong() ) { val = sc.nextLong(); // do stuff }
@Override public boolean hasLong() { return getHandle().hasNextLong(); }