Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // =============================================
- // Shawn McAllister
- // Week 5 Debug
- // 3 bugs
- // =============================================
- import javax.swing.JOptionPane;
- import java.util.Array;
- public class week5DebugBroken {
- private static int arrSort(int[] arr){
- int temp;
- for(int i = 0; i < arr.length - 1; i++){
- for(int j = 0; j < arr.length - 1; j++){
- if(arr[j] > arr[j + 1]){
- temp = arr[j];
- arr[j] = arr[j + 1];
- arr[j + 1] = temp;
- }
- }
- }
- return arr;
- }
- public static void main(String[] args){
- int arr[] = { 22, 15, 10, 55, 5, 23};
- arrSort(arr);
- JOptionPane.showMessageDialog(null, Array.toString(arr));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement