Díky moc, funguje to. Dám sem aj kód, až by ho niekto potreboval:
Kód:
public class JavaCvicenie {
public static void main(String[] args) {
final int n = 100;//velkost pola
int pole[] = new int[n];
int begin = 0, end = n-1, temp;
//naplnenie pola
for (int i = 0; i < n; i++){
temp = (int) (-50 + Math.random() * 100);
System.out.print(temp + " ");
if (temp < 0){
pole[begin] = temp;
begin++;
}
if (temp > 0){
pole[end] = temp;
end--;
}
}
System.out.println();//odriadkovanie
//vypis pola
for (int i = 0; i < n; i++)
System.out.print(pole[i] + " ");
}
}
@BX: Nuly sa vždy nejako uspodiarajú samé
