title: Java Byte Array to String to Byte Array
body: <p>I'm trying to understand a byte[] to string, string representation of byte[] to byte[] conversion... I convert my byte[] to a string to send, I then expect my web service (written in python) to echo the data straight back to the client.</p>
  
  <p>When I send the data from my Java application...</p>
  
  <pre><code>Arrays.toString(data.toByteArray())
  </code></pre>
  
  <p>Bytes to send.. </p>
  
  <pre><code>[B@405217f8
  </code></pre>
  
  <p>Send (This is the result of Arrays.toString() which should be a string representation of my byte data, this data will be sent across the wire): </p>
  
  <pre><code>[-47, 1, 16, 84, 2, 101, 110, 83, 111, 109, 101, 32, 78, 70, 67, 32, 68, 97, 116, 97]
  </code></pre>
  
  <p>On the python side, the python server returns a string to the caller (which I can see is the same as the string I sent to the server</p>
  
  <pre><code>[-47, 1, 16, 84, 2, 101, 110, 83, 111, 109, 101, 32, 78, 70, 67, 32, 68, 97, 116, 97]
  </code></pre>
  
  <p>The server should return this data to the client, where it can be verified. </p>
  
  <p>The response my client receives (as a string) looks like</p>
  
  <pre><code>[-47, 1, 16, 84, 2, 101, 110, 83, 111, 109, 101, 32, 78, 70, 67, 32, 68, 97, 116, 97]
  </code></pre>
  
  <p>I can't seem to figure out how to get the received string back into a 
  byte[]</p>
  
  <p>Whatever I seem to try I end up getting a byte array which looks as follows...</p>
  
  <pre><code>[91, 45, 52, 55, 44, 32, 49, 44, 32, 49, 54, 44, 32, 56, 52, 44, 32, 50, 44, 32, 49, 48, 49, 44, 32, 49, 49, 48, 44, 32, 56, 51, 44, 32, 49, 49, 49, 44, 32, 49, 48, 57, 44, 32, 49, 48, 49, 44, 32, 51, 50, 44, 32, 55, 56, 44, 32, 55, 48, 44, 32, 54, 55, 44, 32, 51, 50, 44, 32, 54, 56, 44, 32, 57, 55, 44, 32, 49, 49, 54, 44, 32, 57, 55, 93]
  </code></pre>
  
  <p>or I can get a byte representation which is as follows:</p>
  
  <pre><code>B@2a80d889
  </code></pre>
  
  <p>Both of these are different from my sent data... I'm sure Im missing something truly simple.... </p>
  
  <p>Any help?!</p>