private static byte[] getBOMFromBytes(byte @NotNull [] contents) {
    Charset charset = CharsetToolkit.guessFromBOM(contents);
    if (charset == null) {
      return null;
    }
    if (charset.equals(StandardCharsets.UTF_8)) {
      return CharsetToolkit.UTF8_BOM;
    }
    return CharsetToolkit.getMandatoryBom(charset);
  }
private static byte[] getBOMFromBytes(byte @NotNull [] contents)