Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int N = 456778889;
- double expo = Math.log10(N);
- int expNum = (int)Math.floor(expo)+1; //gets the total digits in the Integer N
- StringBuilder sb = new StringBuilder("1");
- sb.setLength(expNum);
- 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
- int mostSigNum = N/(Integer.valueOf(f));
- System.out.println(mostSigNum);
- int maxi = (int)(N/Math.pow(10, Math.floor(Math.log10(N))));
- int maxi = Character.digit(String.valueOf(N).charAt(0), 10);
- int N = 456778889;
- double expo = Math.log10(N);
- int expNum = (int)Math.floor(expo);
- String c = IntStream.range(0,expNum).mapToObj(e->"0").collect(Collectors.joining(""));
- String t = "1".concat(c);
- int maxi = N/Integer.parseInt(t);
- System.out.println(maxi);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement