I have written this class which sorts the array using bubble sort. Please let me know how can I improve it. (I don't like recurrent code in if/else statement)public class BubbleSort {public static void numbers(int[] array){    numbers(array, '<');}public static void numbers(int[] array, char direction){    if(direction == '<'){        for(int i = 0; i < array.length - 1; i++){            for(int j = 0; j < array.length - i - 1; j++){                if(array[j] < array[j + 1]){                    int tmp = array[j];                    array[j] = array[j+1];                    array[j+1] = tmp;                }            }        }    }    else{        for(int i = 0; i < array.length - 1; i++){            for(int j = 0; j < array.length - i - 1; j++){                if(array[j] > array[j + 1]){                    int tmp = array[j];                    array[j] = array[j+1];                    array[j+1] = tmp;                }            }        }    }}public static void letters(char[] array){    letters(array, '<');}public static void letters(char[] array, char direction){    if(direction == '<'){        for(int i = 0; i < array.length - 1; i++){            for(int j = 0; j < array.length - i - 1; j++){                if(array[j] < array[j + 1]){                    char tmp = array[j];                    array[j] = array[j+1];                    array[j+1] = tmp;                }            }        }    }    else{        for(int i = 0; i < array.length - 1; i++){            for(int j = 0; j < array.length - i - 1; j++){                if(array[j] > array[j + 1]){                    char tmp = array[j];                    array[j] = array[j+1];                    array[j+1] = tmp;                }            }        }    }}   }
Bubble sort class in Java
java;sorting;reinventing the wheel