Program to implement ASCII lookup table | Java implementation for ASCII table lookup ; Function to convert decimal value to equivalent octal value ; Function to convert decimal value to equivalent hexadecimal value ; Function to convert decimal value to equivalent HTML value ; ASCII lookup table ; Implicit typecasting converts the character into it 's equivalent ASCII ; driver function
import java . util . * ; import java . lang . * ; class GeeksforGeeks { static int Octal ( int decimal ) { int octal = 0 ; String temp = " " ; while ( decimal > 0 ) { int remainder = decimal % 8 ; temp = remainder + temp ; decimal /= 8 ; } for ( int i = 0 ; i < temp . length ( ) ; i ++ ) octal = ( octal * 10 ) + ( temp . charAt ( i ) - '0' ) ; return octal ; } static String Hexadecimal ( int decimal ) { String hex = " " ; while ( decimal > 0 ) { int remainder = decimal % 16 ; if ( remainder >= 0 && remainder <= 9 ) hex = remainder + hex ; else hex = ( char ) ( ' A ' + remainder % 10 ) + hex ; decimal /= 16 ; } return hex ; } static String HTML ( int decimal ) { String html = " " ; html = html + decimal ; html = " & # " + html + " ; " ; return html ; } static void ASCIIlookuptable ( char ch ) { int decimal = ch ; System . out . println ( " Octal ▁ value : ▁ " + Octal ( decimal ) ) ; System . out . println ( " Decimal ▁ value : ▁ " + decimal ) ; System . out . println ( " Hexadecimal ▁ value : ▁ " + Hexadecimal ( decimal ) ) ; System . out . println ( " HTML ▁ value : ▁ " + HTML ( decimal ) ) ; } public static void main ( String args [ ] ) { char ch = ' @ ' ; ASCIIlookuptable ( ch ) ; } }