title: Guessing the encoding of text represented as byte[] in Java
body: <p>Given an array of bytes representing text in some unknown encoding (usually UTF-8 or ISO-8859-1, but not necessarily so), what is the best way to obtain a guess for the most likely encoding used (in Java)?</p>
  
  <p>Worth noting:</p>
  
  <ul>
  <li>No additional meta-data is available. The byte array is literally the only available input.</li>
  <li>The detection algorithm will obviously not be 100 % correct. If the algorithm is correct in more than say 80 % of the cases that is good enough.</li>
  </ul>