Minimum number of cuts required to pay salary from N length Gold Bar | JAVA Implementation to find the minimum number of cuts to pay the worker . ; Function to find the minimum number of cuts to pay the worker . ; Nearest Integer to the Log value of the number N ; Driver code ; Cuts Required in the Length of 15
class GFG { static int pay ( int n ) { int cuts = ( int ) ( Math . log ( n ) / Math . log ( 2 ) ) ; return cuts ; } public static void main ( String [ ] args ) { int n = 5 ; int cuts = pay ( n ) ; System . out . print ( cuts + "NEW_LINE"); n = 15 ; cuts = pay ( n ) ; System . out . print ( cuts ) ; } }