Code:
public static int read() throws IOException {
    return Integer.parseInt(stdin.readLine().trim());
}   

public static double readDouble() throws IOException {
    return Double.parseDouble(stdin.readLine().trim());
}
Stichwort: Wrapper Klassen