Advertisement
veter_3000

Untitled

Jan 28th, 2015
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. sortArray = { line ->
  2.  
  3. String[] array = line.split("")
  4. def tmp = 0
  5. def right = array.length - 1
  6. for (def i=0; i < right; i++) {
  7. for (def j = i + 1; j <= right; j++) {
  8. if (array[j] < array[i]) {
  9. tmp = array[i]
  10. array[i] = array[j]
  11. array[j] = tmp
  12. }
  13. }
  14. }
  15. return array.join("")
  16. }
  17. println sortArray("кабан упал и лапу набока")
  18. ----------------------------------------------------
  19. ааааааббиккллнноппуу
  20.  
  21. Process finished with exit code 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement