Read the instruction wrong for HDD, fixed
This commit is contained in:
parent
6b1af4cf0c
commit
662b668321
Binary file not shown.
|
@ -7,28 +7,10 @@ public class HistogramDataDisplay extends DataDisplay {
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
System.out.println(getClass() + ": " + name);
|
System.out.println(getClass() + ": " + name);
|
||||||
int[] sortedArray = super.getContent();
|
for (int i = 0; i < super.getContent().length; i++)
|
||||||
boolean isSorted = false;
|
System.out.format("%s%d\t%s", (i == 0) ? "" : "\n", super.getContent()[i],
|
||||||
while (!isSorted) {
|
"*".repeat(super.getContent()[i]));
|
||||||
isSorted = true;
|
|
||||||
for (int i = 0; i < sortedArray.length - 1; i++) {
|
|
||||||
if (sortedArray[i] > sortedArray[i + 1]) {
|
|
||||||
int temp = sortedArray[i];
|
|
||||||
sortedArray[i] = sortedArray[i + 1];
|
|
||||||
sortedArray[i + 1] = temp;
|
|
||||||
isSorted = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int lastVal = -1;
|
|
||||||
for (int i : sortedArray) {
|
|
||||||
if (i == lastVal)
|
|
||||||
System.out.print("*");
|
|
||||||
else {
|
|
||||||
System.out.format("%s%d\t*", (lastVal == -1) ? "" : "\n", i);
|
|
||||||
lastVal = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue