Guest User

Untitled

a guest
Apr 27th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. public static char[] read() throws Exception {
  2.  
  3. char[] input;
  4. int buffercount = 1;
  5. char[] buffer = new char[buffercount];
  6. int counter = 0;
  7. while ((buffer[counter] = (char) System.in.read()) != '\r' && buffer[counter] != '\n') {
  8. counter++;
  9. buffercount++;
  10. }
  11.  
  12. input = new char[counter];
  13. for (int i = 0; i < counter; i++)
  14. input[i] = buffer[i];
  15.  
  16. return input;
  17. }
Add Comment
Please, Sign In to add comment