title: Java ByteBuffer to String
body: <p>Is this a correct approach to convert ByteBuffer to String in this way,</p>
  
  <pre><code>String k = "abcd";
  ByteBuffer b = ByteBuffer.wrap(k.getBytes());
  String v = new String(b.array());
  
  if(k.equals(v))
      System.out.println("it worked");
  else
      System.out.println("did not work");
  </code></pre>
  
  <p>The reason I ask is that is this looks too simple, whereas other approaches like <a href="https://stackoverflow.com/questions/1252468/java-converting-string-to-and-from-bytebuffer-and-associated-problems">Java: Converting String to and from ByteBuffer and associated problems</a> looks more complex.</p>