Bit shifting for int and long value : Binary Bit « Data Types « C# / C Sharp






Bit shifting for int and long value

  



using System;
class MainClass11
{
    static void Main()
    {
        int i = 1;
        long lg = 1;
        Console.WriteLine("0x{0:x}", i << 1);
        Console.WriteLine("0x{0:x}", i << 33);
        Console.WriteLine("0x{0:x}", lg << 33);
    }
}

   
    
  








Related examples in the same category

1.Using the Bitwise Complement Operators with Various Data TypesUsing the Bitwise Complement Operators with Various Data Types
2.Obtaining the Most Significant or Least Significant Bits of a NumberObtaining the Most Significant or Least Significant Bits of a Number
3.Binary Data TestBinary Data Test
4.Binary Network Byte OrderBinary Network Byte Order
5.Int binary
6.Get hash code for a byte array
7.Clone a byte array
8.Count the number of bit
9.Bit Helper
10.Returns how many bits are necessary to hold a certain number