Sort the integers array and set the index of smallest and largest element
Arrays . sort ( integers ) ; int lowerIndex = 0 ; int higherIndex = integers . length - 1 ; StringBuilder sb = new StringBuilder ( ) ;