Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. int N = 456778889;
  2. double expo = Math.log10(N);
  3. int expNum = (int)Math.floor(expo)+1; //gets the total digits in the Integer N
  4.  
  5. StringBuilder sb = new StringBuilder("1");
  6. sb.setLength(expNum);
  7. String f = sb.toString().replaceAll("[^0-9]","0"); // It makes the 1 followed by X amount of zero that i require to get my MSB
  8. int mostSigNum = N/(Integer.valueOf(f));
  9. System.out.println(mostSigNum);
  10.  
  11. int maxi = (int)(N/Math.pow(10, Math.floor(Math.log10(N))));
  12.  
  13. int maxi = Character.digit(String.valueOf(N).charAt(0), 10);
  14.  
  15. int N = 456778889;
  16. double expo = Math.log10(N);
  17. int expNum = (int)Math.floor(expo);
  18.  
  19. String c = IntStream.range(0,expNum).mapToObj(e->"0").collect(Collectors.joining(""));
  20. String t = "1".concat(c);
  21. int maxi = N/Integer.parseInt(t);
  22. System.out.println(maxi);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement