Java tutorial
//package com.java2s; import java.util.Arrays; public class Main { /** * The Byte Ordering Mark of Unicode encoding for Windows-based files. */ private static final byte[] UNICODE_BOE = new byte[] { (byte) 0xFF, (byte) 0xFE }; public static boolean boeIsUnicode(byte[] boe) { if (null == boe || boe.length < 2) { return false; } return Arrays.equals(UNICODE_BOE, boe); } }