Purpose - Find all prime numbers between 0 and 'upperLimit'

How can I take the prime numbers and output them to a .csv file using a separate class?

Thanks.
public class Sieve {
 
        private static int upperLimit = 1000000;
	private static boolean[] flags;
 
	public Sieve() {
	}
 
	public static void main (String[] args) {
		initialize(args);
		findPrimes();
		displayPrimes();
	}
 
	private static void initialize(String[] args) {
		if (args.length > 0) {
			upperLimit = Integer.parseInt (args[0]);
		}
		flags = new boolean[upperLimit + 1];
		for (int position = 0; position <= upperLimit; position++) {
		}
 
	}
 
	private static void findPrimes() {
		for (int position = 2; position <= Math.sqrt(upperLimit); position++) {
			if (!flags[position]) {
				int multiple = position * 2;
				while (multiple <= upperLimit) {
					flags[multiple] = true;
					multiple += position;
				}
			}
		}
	}
 
	private static void displayPrimes() {
		for (int position = 2; position <= upperLimit; position++) {
			if (!flags[position]) {
				System.out.print(position + ", ");
			}
		}
	}
}