List of usage examples for java.util Scanner useRadix
public Scanner useRadix(int radix)
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); // display the new radix System.out.println(scanner.radix()); scanner.close();//w ww .j a v a 2 s . c om }
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); // display the new radix System.out.println(scanner.radix()); scanner.close();/*from w w w. j av a 2 s.c o m*/ }
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); // display the new radix System.out.println(scanner.radix()); scanner.close();//from ww w. j a v a 2 s. c om }
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); // display the new radix System.out.println(scanner.radix()); scanner.close();/*from w ww. j a v a2s .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 locale of this scanner scanner.useLocale(Locale.US); // change the radix of this scanner scanner.useRadix(30); // reset and check the values for radix and locale, which are the default scanner.reset();// w w w. j a v a 2 s .c o m System.out.println(scanner.radix()); System.out.println(scanner.locale()); scanner.close(); }