// This program prints three diamonds. public class Diamond3 { public static final int SIZE = 8; public static void main(String[] args) { drawDiamond(); drawDiamond(); drawDiamond(); } // prints one diamond public static void drawDiamond() { for (int row = 1; row <= SIZE; row++) { drawStrings(SIZE - row, " "); System.out.print("/"); drawStrings(2 * row - 2, "."); System.out.println("\\"); } for (int row = SIZE; row >= 1; row--) { drawStrings(SIZE - row, " "); System.out.print("\\"); drawStrings(2 * row - 2, "."); System.out.println("/"); } } // prints count occurrences of text to System.out public static void drawStrings(int count, String text) { for (int i = 1; i <= count; i++) { System.out.print(text); } } }