String (byte @NotNull [] bytes, final @NotNull Charset charset) { int bomLength = getBOMLength(bytes, charset); final CharBuffer charBuffer = charset.decode(ByteBuffer.wrap(bytes, bomLength, bytes.length - bomLength)); return charBuffer.toString(); }