I think I am doing this wrong, I tried to put the prime numbers I'm printing into an array for the purpose of later cubing them (multiplying them by themselves x3.) Is this the most logical way to do this? Is there a better way to store them for manipulation?
package thingy;
public class thingy {
public static void main(String[] args) {
int x=102;
for(int i=2;i<=102;i++) {
isPrime(i);
int [] array2= {array*array*array};
}
}
static void isPrime(int n) {
int i,m=0,flag=0;
;//it is the number to be checked
m=n/2;
if(n==0||n==1){
}else{
for(i=2;i<=m;i++){
if(n%i==0){
flag=1;
break;
}
}
if(flag==0) { System.out.println(n+" is prime number"); }
int [] array = {n};
}//end of else
}
}