// Utility function to read a line from standard input static String readEntry (String prompt) { try { StringBuffer buffer = new StringBuffer (); System.out.print (prompt); System.out.flush (); int c = System.in.read (); while (c != '\n' && c != -1) { buffer.append ((char)c); c = System.in.read (); } return buffer.toString ().trim (); } catch (IOException e) { return ""; } }