I made this program to calculate set of numbers
public void himpunanIrisan(){
System.out.print("The Result is {");
for(int k=1; k<=setofB; k++){
boolean Sama = false;
for(int i=1; i<=setofA; i++){
if(numberB[k] == numberA[i]){
Sama = true;
}
} if (Sama==true){
System.out.print(numberB[k]+ ",");
}
} System.out.println("}");
}
and the output will show like this
The Result is {1,2,}
is there any way so the other comma will disappear?