Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. public class GenerateAllRotation {
  2.  
  3. public static void main(String[] args) {
  4. generateRotation(1445);
  5. }
  6.  
  7. private static int len(int num){
  8. int count=0;
  9. while (num >0){
  10. count++;
  11. num/=10;
  12. }
  13. return count;
  14. }
  15.  
  16. private static void generateRotation(int number){
  17. int len = len(number)-1;
  18. while (len>0){
  19. int x = (int) (number%Math.pow(10,len));
  20. int y = (int) (number/Math.pow(10,len));
  21. System.out.println(String.valueOf(x)+String.valueOf(y));
  22. len--;
  23. }
  24. }
  25.  
  26.  
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement