Here you can find the source of read()
public static Double read()
//package com.java2s; //License from project: Open Source License import java.util.Scanner; public class Main { public static Double read() { try {//from w ww. j a v a2s . c o m return Double.parseDouble(new Scanner(System.in).nextLine()); } catch (NumberFormatException e) { return null; } } }