title: Convert long to string and string to long in java
body: <p>After a lot of searching, I am unable to find what i am looking for</p>
  
  <p>I have 2 questions like:</p>
  
  <pre><code>String str = "Hello"
  </code></pre>
  
  <p>Now I want its value in long</p>
  
  <blockquote>
    <p>072101108108111L</p>
    
    <p>where Ascii</p>
    
    <p>072 = H</p>
    
    <p>101 = e</p>
    
    <p>108 = l</p>
    
    <p>108 = l</p>
    
    <p>111 = o</p>
  </blockquote>
  
  <p>makes <code>Hello</code>.</p>
  
  <p>How can I do this and then convert it back to string?</p>
  
  <p>For example if I have a long value</p>
  
  <pre><code> 072101108108111L
  </code></pre>
  
  <p>then how can I get back the string "Hello" in java?</p>
  
  <p>here is where I am at:</p>
  
  <p>I can get string to long like this</p>
  
  <pre><code>String str = "Hello";
  
  StringBuilder sb = new StringBuilder();
  for (char c : str.toCharArray())
     sb.append((int)c);
     BigInteger mInt = new BigInteger(sb.toString());
     String valu = mIn.tostring();
  </code></pre>
  
  <p>but value is 72 for "H"; I want it to be 072 so that the result is 3 characters, so that it fits the function to convert back to String. </p>
  
  <p>Any help plz</p>