title: How to make a given length byte array composed of other given length bytes arrays JAVA
body: <p>I want to send a byte Array of 256 byte length, it have to be 128 byte of a string and the same length with another string ( lengths are just for testing purposes).</p>
  
  <p>This is my code:</p>
  
  <pre><code>public void packetCompose(String user, String password) {
      //insert user in 128 bytes length, same with password 
      //and make a 256 length byte array to send
      byte[] userBytes = user.getBytes();
      byte[] passwordBytes = password.getBytes();
      byte[] buf = new byte[256];
  }
  </code></pre>
  
  <p>I want to userBytes be 128 bytes length, even if there are more bytes than needed, and the same with passwordBytes. Then make buf be like userBytes followed by passwordBytes.</p>
  
  <p>Any suggestions? thanks in advance</p>