@@ -0,0 +1,420 @@
+// Java implementation to set the kth bit %0A%0A// of the given number %0A%0Apublic class SetKthBit %7B %0A%0A%09// function to set the kth bit %0A%0Apublic static int setKthBit(int n, int k) %7B%0A%0A%0A%0A%09// kth bit of n is being set by this operation %0A%0A%09return ((1 %3C%3C k) %7C n); %0A%0A%7D %0A%0A// Driver code %0A%0Apublic static void main(String arg%5B%5D) %7B%0A%0A%0A%0A%09int n = 10, k = 2; %0A%0A%09System.out.print(%22Kth bit set number = %22 + %0A%0A%09%09%09%09%09%09%09setKthBit(n, k)); %0A%0A%7D %0A%0A%7D %0A%0A

Set Kth Bit program in Java