Using only standard API, the DataInputStream
class has a method called readFully
that fills a byte array from the stream:
byte[] data = new byte[lengthtoread];
DataInputStream in = new DataInputStream(mmInStream);
in.readFully(data);
Don't forget to close the streams when you are done with them!