public static void main(String[] args) {
int[] arr={1,2,3,4};
printfs(arr);
System.out.println("-------");
prints(arr);
}
public static void prints(int[] arr){
for(int i=0;i<arr.length;i++){
int count = arr.length-i;
while(count>1){
System.out.print(" ");
--count;
}
for(int l=0;l<=i;l++){
System.out.print("*");
}
for(int m=i-1;m>=0;m--){
System.out.print("*");
}
System.out.print("\n");
}
}
public static void printfs(int[] arr){
for(int i=0;i<arr.length;i++){
int count = arr.length-i;
while(count>1){
System.out.print(" ");
--count;
}
for(int l=0;l<=i;l++){
System.out.print("*");
System.out.print(" ");
}
System.out.print("\n");
}
}