Alexander Kiel: Benutzereingabe lesen bei Applikationen???

Beitrag lesen

Hallo Stefan,

-----------------Java---API----Docu---------------------------
public int read(byte b[]) throws IOException

Reads up to b.length bytes of data from this input stream into an array of bytes.
The read method of InputStream calls the read method of three arguments with the arguments b, 0, and b.length.

Parameters:
b - the buffer into which the data is read.
Returns:
the total number of bytes read into the buffer, or -1 is there is no more data because the end of the stream has been reached.
Throws: IOException
if an I/O error occurs.
See Also:
read
-----------------Java---API----Docu---------------------------

Wie du siehst steht die Eingabe in buffer und der Rückgabewert der Funktion ist die Länge der Eingabe.

du hast z.B.      byte[] buff = new byte[100];
                  int len = System.in.read(buff);
                  string eingabe = new String(buff,0,0,len);
                  System.out.println(eingabe);

Wie du den buff in einen Int bekommst weiß ich jetzt nicht, musst du selbst mal schauen.

ALEX