server_crash 64 Postaholic

I have this code that creates a triangle based on user input, which is the base of the triangle. Now, what I want to know, is how could you display the triangle upside down, and have spaces in between the astrix..To see what I'm talking about, compile and run the code:

import java.io.*;

public class Triangles
{
  public static void main(String[] args) throws IOException
  {
	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	System.out.println("Enter base of triangle(Must be an odd integer)");
	Integer base = Integer.parseInt(br.readLine());
	int counter = base-1;
	for (int i=0; i<base; i++)
	{
		calculateSpaces(counter);
		for (int j=base; j>counter; j--)
		{
			System.out.print("*");
		}
		System.out.println("");
			counter-=2;	
		if (counter < 0)
		{
			break;
		}
	}
   }
	public static void calculateSpaces(int count)
	{
		int spaces = count/2+3;
		for (int i=0; i<spaces; i++)
		{
			System.out.print(" ");
		}
	}
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.