Example usage for java.util Scanner radix

List of usage examples for java.util Scanner radix

Introduction

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

Prototype

int radix

To view the source code for java.util Scanner radix.

Click Source Link

Usage

From source file:Main.java

public static void main(String[] args) {

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

    Scanner scanner = new Scanner(s);

    System.out.println(scanner.nextLine());

    // print the default radix
    System.out.println(scanner.radix());

    scanner.close();//www  .j  a v  a 2 s  . c o m
}

From source file:Main.java

public static void main(String[] args) {

    String s = "java2s.com 1 + 1 = 2.0 true ";
    Scanner scanner = new Scanner(s);

    System.out.println(scanner.nextLine());

    // change the radix of the scanner
    scanner.useRadix(32);/*from  ww  w . j a va 2  s .co  m*/

    // display the new radix
    System.out.println(scanner.radix());

    scanner.close();
}

From source file:Main.java

public static void main(String[] args) {

    String s = "java2s.com 1 + 1 = 2.0 true ";
    Scanner scanner = new Scanner(new StringReader(s));

    System.out.println(scanner.nextLine());

    // change the radix of the scanner
    scanner.useRadix(32);// w  w w.  j a va  2 s .  c  om

    // display the new radix
    System.out.println(scanner.radix());

    scanner.close();
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException {

    Scanner scanner = new Scanner(new FileInputStream("c:/text.txt").getChannel());

    System.out.println(scanner.nextLine());

    // change the radix of the scanner
    scanner.useRadix(32);//  w  ww.  j av a 2 s.  com

    // display the new radix
    System.out.println(scanner.radix());

    scanner.close();
}

From source file:Main.java

public static void main(String[] args) throws FileNotFoundException {

    Scanner scanner = new Scanner(new FileInputStream("c:/text.txt").getChannel(),
            StandardCharsets.UTF_8.name());

    System.out.println(scanner.nextLine());

    // change the radix of the scanner
    scanner.useRadix(32);//  www  .  j  a  v  a  2s  .  co m

    // display the new radix
    System.out.println(scanner.radix());

    scanner.close();
}

From source file:Main.java

public static void main(String[] args) {

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

    Scanner scanner = new Scanner(s);

    System.out.println(scanner.nextLine());

    // change the locale of this scanner
    scanner.useLocale(Locale.US);

    // change the radix of this scanner
    scanner.useRadix(30);//ww w.j  av a  2 s .c  o m

    // reset and check the values for radix and locale, which are the default
    scanner.reset();
    System.out.println(scanner.radix());
    System.out.println(scanner.locale());

    scanner.close();
}