import java.io.*; public class Input { static BufferedReader stdin = new BufferedReader (new InputStreamReader(System.in)); public static int kluku(String messu) { boolean ok= false; int arvo=0; System.out.print(messu); while (ok == false) { try {arvo = Integer.parseInt(stdin.readLine()); ok = true; } catch (Exception e) {System.out.println("Ei ollut kokonaisluku! Uusi"); ok = false; } } return(arvo); } public static long ikluku(String messu) { boolean ok= false; long arvo=0L; System.out.print(messu); while (ok == false) { try {arvo = Long.parseLong(stdin.readLine()); ok = true; } catch (Exception e) {System.out.println("Ei ollut kokonaisluku! Uusi"); ok = false; } } return(arvo); } public static float fluku(String messu) { float arvo=0F; boolean ok = false; System.out.print(messu); while (ok==false) { try {arvo = Float.valueOf(stdin.readLine()).floatValue(); ok = true; } catch (Exception e) {System.out.println("Ei ollut desiluku! Uusi"); ok = false; } } return(arvo); } public static double dluku(String messu) { double arvo=0; boolean ok = false; System.out.print(messu); while (ok==false) { try {arvo = Double.valueOf(stdin.readLine()).doubleValue(); ok = true; } catch (Exception e) {System.out.println("Ei ollut desiluku! Uusi"); ok = false; } } return(arvo); } public static String mjono(String messu) { String arvo = null; boolean ok = false; System.out.print(messu); while (ok==false) { try {arvo = stdin.readLine(); ok = true; } catch (Exception e) {System.out.println("Lukemisessa ongelmia! Uusi"); ok = false; } } return(arvo); } public static char merkki(String messu) { char arvo = ' '; boolean ok = false; System.out.print(messu); while (ok==false) { try {arvo = (stdin.readLine()).charAt(0); ok = true; } catch (Exception e) {System.out.println("Lukemisessa ongelmia! Uusi"); ok = false; } } return(arvo); } public static boolean looginen(String messu) { boolean arvo=false; boolean ok = false; System.out.print(messu); while (ok==false) { try {arvo = Boolean.valueOf(stdin.readLine()).booleanValue(); ok = true; } catch (Exception e) {System.out.println("Ei ollut true tai false! Uusi"); ok = false; } } return(arvo); } }