import java.io.*; public class ReadInByteArray { public static void main(String[] args) { try{ File file = new File("tapan.txt"); int size = (int)file.length(); //It gives the length of the file. System.out.println("Size of the file: " + size); } catch (Exception e){ System.out.println("Exception has been thrown :" + e); } } }