public String readLine()throws IOException { byte[] buf = newbyte[64]; // line length intcnt=0; int c; while ((c = read()) != -1) { if (c == '\n') { break; } buf[cnt++] = (byte) c; } returnnewString(buf, 0, cnt); }
publicintnextInt()throws IOException { intret=0; bytec= read(); while (c <= ' ') { c = read(); } booleanneg= (c == '-'); if (neg) { c = read(); } do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9');
if (neg) { return -ret; } return ret; }
publiclongnextLong()throws IOException { longret=0; bytec= read(); while (c <= ' ') { c = read(); } booleanneg= (c == '-'); if (neg) { c = read(); } do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9'); if (neg) { return -ret; } return ret; }
publicdoublenextDouble()throws IOException { doubleret=0; doublediv=1; bytec= read(); while (c <= ' ') { c = read(); } booleanneg= (c == '-'); if (neg) { c = read(); }
do { ret = ret * 10 + c - '0'; } while ((c = read()) >= '0' && c <= '9');
if (c == '.') { while ((c = read()) >= '0' && c <= '9') { ret += (c - '0') / (div *= 10); } }