Example usage for java.util Scanner nextLong

List of usage examples for java.util Scanner nextLong

Introduction

In this page you can find the example usage for java.util Scanner nextLong.

Prototype

public long nextLong(int radix) 

Source Link

Document

Scans the next token of the input as a long .

Usage

From source file:Main.java

public static void main(String[] args) {

    String s = "java2s.com 1 + 1 = 2.0 true 9000000000000000000000L";

    Scanner scanner = new Scanner(s);

    while (scanner.hasNext()) {
        System.out.println("Not Found :" + scanner.next());
        if (scanner.hasNextLong()) {
            System.out.println("Found :" + scanner.nextLong(20));
        }/*from  w  w w.  j a  v a 2 s . c o  m*/
    }
    scanner.close();
}