String readString (int max) {
        int ch, length=0;
        char assembly[] = new char [max];
        try {
            ch = in.read();
            while(ch==' ' || ch=='\n' || ch=='\r') {
                ch = in.read();
            }
            for (int i=0; i<max; i++) {
                assembly[i] = (char)ch;
                if (!(ch==' ' || ch=='\n' || ch=='\r')) {
                    length = i+1;
                }
                ch = in.read();
            }
        } catch (IOException e) {};
        return new String(assembly, 0, length);
    }