In the code below I have 4 for and they run in sequence, but I need them to run all at the same time.
public class main
{
public static void main(String[] args)
{
long init = System.currentTimeMillis();
ataque(999999, 999999);
long end = System.currentTimeMillis();
long diff = end - init;
System.out.print("Demorou " + (diff / 1000) + " segundos");
}
public static void ataque(int limite, int busca)
{
int for1 = 0;
int for2 = limite / 4;
int for3 = for2 + for2;
int for4 = for2 = for3;
for(int i = for1; i < for2; i++)
{
/*if(i == busca)
{
break;
}*/
System.out.println(i + " de " + busca + "\r");
}
for(int i = for2; i < for3; i++)
{
/*if(i == busca)
{
break;
}*/
System.out.println(i + " de " + busca + "\r");
}
for(int i = for3; i < for4; i++)
{
/*if(i == busca)
{
break;
}*/
System.out.println(i + " de " + busca + "\r");
}
for(int i = for4; i < limite; i++)
{
/*if(i == busca)
{
break;
}*/
System.out.println(i + " de " + busca + "\r");
}
}
}