Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.programs.common.ClearCorrect;
- /**
- * Created by Sireesha on 8/12/19.
- */
- public class SortArray {
- public static void main(String args[]) {
- SortArray sortArray = new SortArray();
- int[] inputArr = {5,1,1,2,0,0};
- sortArray.sortArrayFun(inputArr);
- }
- public int[] sortArrayFun(int[] inputArr) {
- for(int i = 0; i < inputArr.length; i++) {
- for(int j = i + 1; j < inputArr.length; j++) {
- if(inputArr[i] > inputArr[j]) {
- int tmp = inputArr[i];
- inputArr[i] = inputArr[j];
- inputArr[j] = tmp;
- }
- }
- }
- return inputArr;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement