I have read a lot of questions related to the topic and finally was able to write this code
StatFs statFs = new StatFs(Environment.getRootDirectory().getAbsolutePath());
long blockSize = statFs.getBlockSizeLong();
long totalSizeInternal = statFs.getBlockCountLong()*blockSize;
long freeSizeInternal = statFs.getFreeBlocksLong()*blockSize;
statFs = new StatFs(Environment.getExternalStorageDirectory().getAbsolutePath());
blockSize = statFs.getBlockSizeLong();
long totalSizeExternal = statFs.getBlockCountLong()*blockSize;
long freeSizeExternal = statFs.getFreeBlocksLong() * blockSize;
Log.d("printingDetails", totalSizeExternal + "");
Log.d("printingDetails", freeSizeExternal + "");
Log.d("printingDetails", totalSizeInternal + "");
Log.d("printingDetails", freeSizeInternal + "");
Log.d("printingDetails", Environment.isExternalStorageRemovable() + "");
and was able to get this output for my redmi 3s phone freeSizeExternal : 2034581504 totalSizeExternal : 10486845440 freeSizeInternal : 308924416 totalSizeInternal : 3095707648
and my redmi 3s have an internal storage of 16GB only no external sd card is inserted, with a free space of over 2.1GB,and when i checked over micromax phone with an SD CARD of 32GB and internal mermory of 2GB, i got the following results like external storage is showing around 29GB and internal storage is around 700MB which it is showing, can anyone explain me what is internal and external size in the both cases and why are they so different from the original size, and also provide me the correct code which displays the correct size of internal as well as external memory of phone.