import java.io.*; import java.util.*; class Program { private static String readFileAsString(String filePath) throws IOException { byte[] buffer = new byte[(int) new File(filePath).length()]; FileInputStream f = new FileInputStream(filePath); f.read(buffer); return new String(buffer); } public static void main(String[] args) throws IOException { String str = readFileAsString("adat.txt"); System.out.println(str); } }