Code example for Scanner

Methods: hasNextLong, hasNextShort, nextInt, nextLong

0
	 * @throws IOException 
	 * @tests java.util.Scanner#hasNextLong(int) 
	 */ 
    public void test_hasNextLongI_cache() throws IOException { 
        //regression for HARMONY-2063 
    	s = new Scanner("123 456");
		assertTrue(s.hasNextLong(16));
		assertEquals(291, s.nextLong());
		assertEquals(456, s.nextLong());
 
		s = new Scanner("123 456");
		assertTrue(s.hasNextLong(16));
		assertTrue(s.hasNextLong(8));
		assertEquals(83, s.nextLong());
		assertEquals(456, s.nextLong());
 
		s = new Scanner("-123 -456 -789");
		assertTrue(s.hasNextLong(8));
		assertEquals(-123, s.nextInt());
		assertEquals(-456, s.nextLong());
		assertTrue(s.hasNextShort(16));