title: How to convert each char in string to 8 bit int? JAVA
body: <p>I've been suggested a TCP-like checksum, which consists of the sum of the (integer) sequence and ack field values, added to a character-by-character sum of the payload field of the packet (i.e., treat each character as if it were an 8 bit integer and just add them together).</p>
  
  <p>I'm assuming it would go along the lines of:</p>
  
  <pre><code>char[] a = data.toCharArray();
  for (int i = 0; int &lt; len; i++) {
     ...
  }
  </code></pre>
  
  <p>Though I'm pretty clueless as to how I could complete the actual conversion?</p>
  
  <p>My <code>data</code> is <code>string</code>, and I wish to go through the string (converted to a char array (though if there's a better way to do this let me know!)) and now I'm ready to iterate though how does one convert each character to an int. I will then be summing the total.</p>