What's wrong with the following code?

public void fillByteArray(InputStream s, byte[] b, int offset, Integer numReads, int readAmount){
    while (numReads > 0){
        s.read(b, offset, readAmount);
        offset += readAmount;
        numReads--;
    }
}
s.read(b, offset, readAmount);
offset += readAmount;

readAmount is the maximum amount to read, not the amount that is actually read. The return value of s.read(b, offset, readAmount) is the amount actually read. You should also be checking for a return value of -1 which indicates the end of the stream. Naturally, whether these things are wrong depends upon your goals.