title: Resetting byte[] buffer to zeros?
body: <p>In the following code for sockets, I declare a byte buffer and listen for client messages in a loop:</p>
  
  <pre><code>// Create some buffer
  byte[] buffer = new byte[512];
  
  while (true)
  {
      // Listen for messages from Client
  
      int length = socket.getInputStream().read(buffer);
  
      if (length != -1)
          System.out.println(new String(buffer));
      else
          break;
  
      // Reset buffer here to zeros?
  }
  </code></pre>
  
  <p>Each time I'd require to reset the contents of buffer to receive a new message. What's the proper way to do this?</p>