Last active
February 1, 2016 02:13
-
-
Save ardamavi/b5c476d2672be5d7a29f to your computer and use it in GitHub Desktop.
BitWise ile İşlemler By Arda Mavi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// By Arda Mavi | |
import java.util.Scanner; | |
public class BitWiseİşlemler { | |
public static void main(String[] args) { | |
// Tanım : | |
Scanner giriş = new Scanner(System.in); | |
int a ; | |
int b ; | |
// Giriş ve işlemler : | |
String ans = "e"; | |
while(!"h".equals(ans)){ | |
System.out.println("Birinci sayıyı giriniz : "); | |
a = giriş.nextInt(); | |
System.out.println("İkinci sayıyı giriniz : "); | |
b = giriş.nextInt(); | |
// Çıktı : | |
System.out.println("\nBitWise işlemler :\n"); | |
// And : | |
System.out.println("AND işlemi :"); | |
System.out.println("İkilik Sayı sistemine göre : " + Integer.toBinaryString(a&b)); | |
System.out.println("İkilik sistemden tamsayıya çevirilmiş hali : " + Integer.parseInt(Integer.toBinaryString(a&b), 2) ); | |
// Or : | |
System.out.println("\nOR işlemi :"); | |
System.out.println("İkilik Sayı sistemine göre : " + Integer.toBinaryString(a|b)); | |
System.out.println("İkilik sistemden tamsayıya çevirilmiş hali : " + Integer.parseInt(Integer.toBinaryString(a|b), 2) ); | |
//XOR : | |
System.out.println("\nXOR işlemi :"); | |
System.out.println("İkilik Sayı sistemine göre : " + Integer.toBinaryString(a^b)); | |
System.out.println("İkilik sistemden tamsayıya çevirilmiş hali : " + Integer.parseInt(Integer.toBinaryString(a^b), 2) ); | |
System.out.println("\nDevam etmek istiyor musunuz ? | Evet : e ||| Hayır : h |"); | |
ans = giriş.next(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment