import java.math.BigInteger; import java.io.*; public class FibonacciText { public static void main(String[] args) { try { FileOutputStream fout = new FileOutputStream("fibonacci.txt"); OutputStreamWriter out = new OutputStreamWriter(fout, "8859_1"); BigInteger low = BigInteger.ZERO; BigInteger high = BigInteger.ONE; for (int i = 0; i <= 25; i++) { out.write(low.toString() + "\r\n"); BigInteger temp = high; high = high.add(low); low = temp; } out.close(); } catch (IOException e) { System.err.println(e); } } }