Driver program to test above
public static void main ( String [ ] args ) { char [ ] bnum = "10010" . toCharArray ( ) ; System . out . println ( " Binary ▁ representation ▁ of ▁ next ▁ greater ▁ number ▁ = ▁ " + nextGreaterWithSameDigits ( bnum ) ) ; } }