Removing leading new line from byte[]
I don't think you can make this specifically better.

What you could do is make the function more generic, but that depends on what your data contains beyond the first two bytes. For example, you could simply skip any and all line feeds and carriage returns at the beginning:

private int skipLFandCR(byte[] bytes) {
    int pos = 0;
    while (pos &lt; bytes.length &amp;&amp; (bytes[pos] == '\r' || bytes[pos] == '\n')) {
        pos++;
    }
    return pos;
}


Also: Do you need a copy of the data? I'd just use a function that returns the start index such as mine and process the existing array starting at that index.