* BOM information from http://www.unicode.org/faq/utf_bom.html
* @param args
*/
public static void main(String[] args) {
Map map = new LinkedHashMap();
map.put("UTF-8", new byte[] { (byte) 0xEF, (byte) 0xbb, (byte) 0xbf, 'H',
'i' });
map.put("UTF-32 BE BOM", new byte[] { 0, 0, (byte) 0xFE, (byte) 0xFF, 'H',
0, 0, 0, 'i', 0, 0, 0 });
map.put("UTF-16 LE BOM", new byte[] { (byte) 0xFF, (byte) 0xFE, 'H', 0,
'i', 0 });
map.put("UTF-16 BE BOM", new byte[] { (byte) 0xFE, (byte) 0xFF, 0, 'H', 0,
'i' });
map.put("UTF-16 LE", new byte[] { 'H', 0, 'i', 0 });
map.put("UTF-16 BE", new byte[] { 0, 'H', 0, 'i' });
for (Iterator iterator = map.keySet().iterator(); iterator.hasNext();) {
String element = (String) iterator.next();
System.out.println(element + ":");
byte[] buffer = (byte[]) map.get(element);
boolean bFirst0 = buffer[0] == 0;
boolean bSecond0 = buffer[1] == 0;
String data = "";
try {