There was an error while loading. Please reload this page.
2 parents dac4822 + 7fbc645 commit 82f400dCopy full SHA for 82f400d
Java/FiveBitManipulation/SubSetWithBitwise.java
@@ -0,0 +1,25 @@
1
+import java.util.*;
2
+
3
+public class SubSetWithBitwise {
4
+ public static void main(String[] args) {
5
+ Scanner sc = new Scanner(System.in);
6
+ String s=sc.next();
7
+ int i,k,n,n1;
8
+ int l=s.length();
9
+ n=(int)Math.pow(2.0,l);
10
+ System.out.print(" ");
11
+ for(i=0;i<n;i++)
12
+ {
13
+ n1=n;
14
+ k=0;
15
+ while(n1!=0)
16
17
+ if(((i>>k)&1) == 1)
18
+ System.out.print(s.charAt(k));
19
+ k++;
20
+ n1/=2;
21
+ }
22
+ System.out.println();
23
24
25
+}
0 commit comments