* Binary.java
*
* Created on 4 Απρίλιος 2008, 8:29 πμ
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
import javax.swing.JOptionPane;
public class Binary {
public Binary() {
}
static String input(){
return JOptionPane.showInputDialog(null,"Dose ena arithmo:");
}
static void massage(String x){
JOptionPane.showMessageDialog(null, "O arithmos einai :" +x);
}
/** Creates a new instance of Binary */
public static void ShowBits(int n){
int m=1;
m=m<<2;
int r=m&n;
r=r>>2;
System.out.println(r);
}
public static void main(String[] args) {
String in= input();
massage(in);
int x=Integer.parseInt(in);
String y =Integer.toBinaryString(x);
ShowBits(x);
System.out.println("o diadikos einai"+y);
JOptionPane.showMessageDialog(null,"o digit einai"+y);
System.exit(0);
}
}