How to get size of file in java

Previous
Next

In this post, we will see how to get size of file in java. We can directly use java.io.File ‘s length method to get its size in bytes. We can convert it to KB and MB accordingly.

When you run above program, you will get following output:

Previous
Next

Join Our News Letter – Stay Updated

Subscribe to Awesome Java Content.




Add Comment

Join Our News Letter - Stay Updated

Subscribe to Awesome Java Content.
You can like our facebook page Java2blog