title: How to remove trailing character(s) from a string
body: <p>I have a file which contains a data structure.  The data is stored as bytes.  I want to display a data (name of person) to screen.  Size of the name is about 12 characters long.  But data may be less than or equal to 12 characters.  I converted the byte array to string and display data. when tried to display data using system.out.println method, it shows data plus unwanted characters.  How to show only wanted data.</p>
  
  <p>i tried with below code</p>
  
  <pre><code>// here Name is a byte array
  title = new String( Name );
  System.out.println("Title = " + title);
  </code></pre>
  
  <p>output i received is</p>
  
  <pre><code>    Title = area1����������
  </code></pre>
  
  <p>i want only 'area1'.   please provide a solution to resolve it</p>