Bubble sort algorithm in Java I have written this code which basically sorts the array using bubble sort, however, I feel it is not very readable. Please let me know me how I can improve this code.

public class BubbleSort {

    public static void main(String[] args) {

        int arr[] = new int[] { 4, 1, 8, 5, 2, 0, 4, 3, 7, 9 };

        for (int i : arr) {
            System.out.print(i + " ");
        }

        for (int i = 1; i &lt; arr.length; i++) {
            for (int j = 0; j &lt; arr.length - i; j++) {
                if (arr[j] &gt; arr[j + 1]) {
                    int temp = arr[j];
                    arr[j] = arr[j + 1];
                    arr[j + 1] = temp;
                }

            }

        }
        System.out.println();
        System.out.println("Sorted array");
        for (int i : arr) {
            System.out.print(i + " ");
        }
    }

}
Your code looks mostly good to me.

One thing: Functions can help increase readability of your code, and reduce the amount of duplicate code. Additionally, they make testing and (re-)using your code easier. Your main method should only be an entry point, it shouldn't really contain any logic itself.

Your main method might look like this:

public static void main(String[] args) {
    int[] array = new int[] { 4, 1, 8, 5, 2, 0, 4, 3, 7, 9 };

    printArray(array);
    int[] sortedArray = sortArray(array);
    printArray(sortedArray);      
}


Then just create those functions. 

Misc


You have some unnecessary newlines after }. 
temp could be renamed swap, making it more obvious what is happening.
arr could be named array (arr may be fine in this context, but generally, you do not want to shorten your variable names, as it is less readable).