Not shure if it has already been told in the answers but imo it would be:
File my_file = new File("filename"); // Get the number of mbs long size = my_file.length() / ((1024 * 1024))
;