Author Archive


Jumble Word Game in Java

In Jumble word game, the computer program randomly picks up a secret word from a database of words and then shuffles it. The shuffled word is presented to the user and he is asked to guess the original word. The program ends when the user correctly guesses the word. The program also prints the number […]

Guess the Number Game in Java

In guess the number game, the computer program will come up with a random number within a range (for example, 1 to 1000). The player (user) is asked to guess this number. If the guessed number is bigger than the actual number, the computer will respond with the message "too high". If the guessed number […]

How to Encrypt and Decrypt Data In Java Using AES Algorithm

AES (Advanced Encryption Standard) is a strong symmetric encryption algorithm. A secret key is used for the both encryption and decryption of data. Only someone who has access to the same secret key can decrypt data. AES encryption provides strong protection to your data. The following sample Java program shows how to encrypt data using […]

How to Generate Random Numbers in a Range in Java

Random numbers are used in a number of programming applications such as games, computer simulation, cryptography etc. It is also used to generate test data. Usually you want to generate random numbers in a specific range of values. The following example program in Java generates 5 random numbers between 10 and 20 (both inclusive). import […]

How to Print Arrays in Java

When working with arrays in Java, it is useful to print the array contents on the console or on the log file. This is useful for debugging the application. It is possible to print one dimensional or multi-dimensional arrays using for loops. However a much easier solution is to use the deepToString() static method of […]