Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. package com.programs.common.ClearCorrect;
  2.  
  3. /**
  4. * Created by Sireesha on 8/12/19.
  5. */
  6. public class SortArray {
  7.  
  8. public static void main(String args[]) {
  9.  
  10. SortArray sortArray = new SortArray();
  11.  
  12. int[] inputArr = {5,1,1,2,0,0};
  13. sortArray.sortArrayFun(inputArr);
  14.  
  15. }
  16. public int[] sortArrayFun(int[] inputArr) {
  17.  
  18. for(int i = 0; i < inputArr.length; i++) {
  19.  
  20. for(int j = i + 1; j < inputArr.length; j++) {
  21.  
  22. if(inputArr[i] > inputArr[j]) {
  23.  
  24. int tmp = inputArr[i];
  25. inputArr[i] = inputArr[j];
  26. inputArr[j] = tmp;
  27. }
  28. }
  29. }
  30.  
  31. return inputArr;
  32. }
  33.  
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement