Quick actions

cmd+k|ctrl+k

Navigation

Languages

Stuff

Snippet info

Language

Java

Visibility

public

Author

mugizico

Created

2016-04-28T16:53:02Z

Updated

2016-04-28T17:23:03Z

import java.util.*;


class Main {
    
    public static void bubbleSort(int [] a){
        
        for(int i = 0; i < a.length; i++){
            for(int j = i+1; j < a.length; j++){
                
                if(a[i] > a[j]){
                    int temp = a[i];
                    a[i] = a[j];
                    a[j] = temp;
                }
            }
        }
    }
    public static void main(String[] args) {
        
        Map<String, Integer> myMap = new HashMap<>();
        myMap.put("Jean Paul", 2015);
        myMap.put("Scott", 2016);
        
        //myMap.forEach( (k,v) -> System.out.println("Key: " + k + ": Value: " + v));
        
        int [] num = {2, 5, -2, 7 , 0, 9, 10, 3};
        bubbleSort(num);
        
        for(int i : num){
            System.out.print(i + " ");
        }
    }
}
INFO