Exemple de shifting: Exemple d’utilisation des Symboles de décalage (<< >>)

Author:


{filelink=4595}

public class LeShifting {
  public static void main(String[] argv) {
    //+
    System.out.println(" 2<<4 = " + (2<<4));
    System.out.println(" 2<<8 = " + (2<<8));
    System.out.println("2<<16 = " + (2<<16));
    System.out.println("2<<24 = " + (2<<24));
    System.out.println("2<<31 = " + (2<<31));
    System.out.println("2<<32 = " + (2<<32));

    // Exemple de Long
    System.out.println("2<<31 = " + ((long)2<<31));
    System.out.println("2<<32 = " + ((long)2<<32));

  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *