title: JAVA: writing and reading buffer from serial using RXTX
body: <p>I've got strange results when I'mt trying to read string buffer from serial com using RXTX.
  After writing a string to COM I've to store the string as reply. And this is inside a loop. The string printed in console sometimes not corrispond to the last write command but belong to the previus one.</p>
  
  <pre><code>     while (running) {
            char campioni = (char) start;
            hexStart = Integer.toHexString(campioni).toUpperCase();
            String stringa = "&gt;eL#" + hexStart + "??!\r\n" + "\n";
            output.write(("&gt;eL" + "L#" + hexStart + "??!\r\n").getBytes());
            output.flush();
  
             byte[] buffer = new byte[10000];
  
             n=0;
         try {
            n = input.read(buffer);
          } catch (IOException e1) {
          e1.printStackTrace();
          }
  
               if(n&gt;0){
                      String data = new String (buffer,0,n);
                      System.out.println(new String(buffer));
                      start=start+5;
                      Thread.sleep(2000); 
                 }
            }
  </code></pre>