public static void main(String[] args) {
Integer[] arr = {1, -1, 7, 0, 9, 5};
for (int i = 0; i < arr.length - 1; i++) {
for (int j = 0; j < arr.length - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
Integer temp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = temp;
}
}
}
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("[");
for (int i = 0; i < arr.length; i++) {
stringBuffer.append(arr[i]);
if (i != arr.length - 1) {
stringBuffer.append(",");
}
}
stringBuffer.append("]");
System.out.println(stringBuffer);
}