byte[] buf = new byte[256];
try {
// input
String str="";
do{
int c = System.in.read(buf,0,buf.length);
str += new String(buf,0,c);
}while(System.in.available()>0) ;
str = str.substring(0,str.length()-1); // remove the last return
}catch(Exception){e.printStackTrace();}
try {
  double value = Double.parseDouble(str);
}catch(Exception e){e.printStackTrace();}