Первоначально я пробовал различные программные подходы в моем html, JS, чтобы очистить кеш браузера. Ничего не работает в последнем Chrome.
Наконец, я закончил с .htaccess:
Header set Cache-Control "no-cache, no-store, must-revalidate"
Header set Pragma "no-cache"
Header set Expires 0
Протестировано в Chrome, Firefox, Opera
Вы не можете получить желаемый результат, потому что вы используете эту закомментированную строку внутри цикла.
import java.util.Random;
public class QuestionTwoAssignmentOne2018 {
private static final int NUM = 10;
public static void main(String[] args) {
Random bytes = new Random(); // take this out of the loops as mentioned
// in the comments
int count = 100; // keep track of 100 '*'s
int arr[] = new int[100];
for (int a = 0; a < 100; a++) {
arr[a] = bytes.nextInt(10); //
}
for (int i = 0; i < NUM; i++)
{
int bcount = 0;
for (int a = 0; a < 100; a++) {
if (arr[a] == NUM - i)
bcount++;
}
System.out.print(NUM - i + " |");
for (int c = 0; c < bcount; c++)
System.out.print("*");
System.out.println();
}
System.out.print(" "); // for better view
for (int i = 0; i < (NUM * 2) - 1 ; i++)
System.out.print("-");
System.out.println();
System.out.print(" "); // for better view
for (int i = 0; i < NUM; i++)
System.out.print(i + " ");
}
}
И я написал более общий код для вас. Вы можете просто изменить константу NUM, чтобы упорядочить количество строк.