Recursive characterization of the operation of finding the maximum among a set of values read from a file that contains positive integers:
Implementation: we access the file through a BufferedReader, and we assume that each integer is written on a separate line.
public static int maximum(BufferedReader br) throws IOException { String s = br.readLine(); if (s == null) return 0; else { int i = Integer.parseInt(s); int m = maximum(br); return (m > i)? m : i; } }