I am doing the same project as describe here:
Wrap deflated data in gzip format
My problem is that when I try to print out bytes, I get weird results. My pro
Assuming your byte array is called buf:
System.out.println(Arrays.toString(buf));
Edit: It sounds like what you really want to do is write your bytes to stdout, not print them. See http://docs.oracle.com/javase/6/docs/api/java/io/PrintStream.html for the difference between printing to a stream and writing to it. Easiest way should be to call the write(byte[] b) method:
System.out.write(buf);
/* There is an image / ic_launcher in the drawable folder for which I am making ByteArray */
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.img);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] mByteArray = stream.toByteArray();
/* here I am showing the raw data not in hexadecimal format */
System.out.println(Arrays.toString(mByteArray));
I think this will help you guys!