What's new

Closed Binary to ascii

Status
Not open for further replies.
Inisang Class ko nalang sya :)

import java.util.Scanner;

public class AssciiCoding {


public static void main (String args []) {
Scanner sc = new Scanner(System.in);


System.out.println("Binary into Characters");
System.out.print("Enter Binary:");
String binary = sc.nextLine();

//Binary to Character
int br = Integer.parseInt(binary,2);
char ch = (char)br;
System.out.println("Character with Binary code "+binary+" is "+ch);

//Character to ASCII
int ascii = (int)ch;
System.out.println("ASCII code of character "+ch+" is "+ascii);

//ASCII to Binary
String fBr = Integer.toBinaryString(ascii);
System.out.println("Binary code of ASCII code "+ascii+" is "+fBr);
}

}

upload_2019-1-26_11-36-56.png
 

Attachments

Inisang Class ko nalang sya :)

import java.util.Scanner;

public class AssciiCoding {


public static void main (String args []) {
Scanner sc = new Scanner(System.in);


System.out.println("Binary into Characters");
System.out.print("Enter Binary:");
String binary = sc.nextLine();

//Binary to Character
int br = Integer.parseInt(binary,2);
char ch = (char)br;
System.out.println("Character with Binary code "+binary+" is "+ch);

//Character to ASCII
int ascii = (int)ch;
System.out.println("ASCII code of character "+ch+" is "+ascii);

//ASCII to Binary
String fBr = Integer.toBinaryString(ascii);
System.out.println("Binary code of ASCII code "+ascii+" is "+fBr);
}

}

View attachment 543200
Maraming salamat paps
 
Status
Not open for further replies.

Similar threads

Back
Top