I'm new in Java and supposed to write a program that prints a number into a diamond shape. It doesn't print correctly, can someone point out where I'm messed up?
private static void diamondOfAsterisks(int number) {
int spaces = number / 2;
int stars = 1;
int row;
int column;
int middle = number / 2;
for(row = 0; row < number; row++){
for( column = 0; column < spaces; column = column +1){
System.out.print(" ");
}
for (column = 0; column < stars; column = column +1 ){
System.out.print("*");
}
System.out.println("");
if ( row < middle){
spaces = spaces - 1;
stars = stars + 1;
}
else{
spaces = spaces + 1;
stars = stars - 1;
}
}
}