Java Program To Print Map of India
Learn How To Write A Program To Print Map of India in Java Programming Language. This is an example of Obfuscated Coding in Java Programming. By nature, Obfuscated Coding is a little difficult to understand.
The String obfs is a Binary Sequence. It is interpreted as an Array of Characters. It is then converted into its corresponding ASCII values. The String obfs is a Run Length Encoding of the Map of India. It, therefore, contains Instructions to Draw the Image of India’s Map in Java Programming.
Java Code To Print Map of India with Obfuscated Coding Style
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | import java.io.*; public class test { public static void main(String[] args) throws Exception { String obfs="TFy!QJu ROo TNn(ROo)SLq SLq ULo+UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^NBELPeHBFHT}TnALVlBLOFAkHFOuFETpHCStHAUFAgcEAelclcn^r^r\\tZvYxXyT|S~Pn SPm SOn TNn ULo0ULo#ULo-WHq!WFs XDt!"; int x = 10, y = 0, z = 10; x = obfs.charAt(y); while (x != 0) { if (y < 170) { x = obfs.charAt(y); y++; while(x > 64) { x--; if(++z == 'Z') { z /= 9; System.out.print((char)(z)); } else System.out.print((char)(33 ^ (y & 0x01))); } } else break; } System.out.println("\n"); } } |
The charAt() method is defined in Java.lang package. This method returns the value of the character at the specified index. The number 33 in the second last System.out.println() method enables to print the Exclamation Mark to Draw the Map of India. This is because the ASCII value 33 represents Exclamation Symbol.
Output

If you have any compilation errors or doubts in this Program To Print Map of India in Java Programming Language, let us know about in the Comment Section below.
Recommended Programs | |
---|---|
Complete Guide For User Input in Java | |
Java Program To Download Any Webpage | |
Java Graphics Program To Draw A Circle | |
100+ Java Programs For Programming Interviews |
MY program has a problem. There is some problem with obfs string. It not compiling I guess.
I’ve checked the program again. Its working perfectly fine Vijay. Ensure that the string obfs should not included any next lines between it. The String in the code to print map of India should be intact and should not include any uneccessary spaces.
Yes. Its been solved. Thanks
StringIndexOutOfBoundsException occurs in main() and chartAt() not found..
It’s working fine here! Please check the import file.
Can you Explain the flow of this program
Why such a long string has been taken and can you explain how exactly programs print for India map at a particular location?
Could you please explain the program.
Can you explain how to come up with the obfs string to plot any map.