How to get the size (Kb or Mb ) of Bitmap in android java

Don't divide by 1024

long bitmap_size = imageInByte.length / 1024;

If you are using Formatter.formatShortFileSize then just use the original length of the byte array.

This code is compressing the image with this:

originalBitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);

How do you know the size of the image after this compression? You might write the compressed image out to a file, however the imageInByte.length has to be the number of bytes in the byte array. Are you sure it is NOT this size?