int binary operation

In this chapter you will learn:

  1. Bitwise AND of Integer
  2. Shifting an integer value

Bitwise AND of Integer

using System;//java  2  s .  co m


class Program
{
    static void Main(string[] args)
    {
        Console.WriteLine("Enter an integer:");
        int myInt = Convert.ToInt32(Console.ReadLine());
        Console.WriteLine("Bitwise AND of Integer and 10 = {0}", myInt & 10);
    }
}

Shifting an integer value

using System;//j  av a 2s. c  o m
class MainClass8
{
    static void Main()
    {
        int a = 1000;
        a >>= 4;
        Console.WriteLine(a);
    }
}

Next chapter...

What you will learn in the next chapter:

  1. Int Parsing
  2. Converts string to integer and catch FormatException
  3. Parse and catch OverflowException
  4. Convert string value to integer by using the int.TryParse
  5. TryParse with while loop
Home » C# Tutorial » Byte, Integer, Long
Integer Family
Integer ranges
byte
Convert to byte
Parse string to byte
byte format
byte octal and hexadecimal
byte binary operation
byte overflow with unchecked
int
int value
Compare int value
int calculation
int value overflow
int binary operation
Parse string to int value
Format int value
int in binary, octal and hexadecimal
long
long value calculation
ulong