Archive for the ‘Java’ Category



Java Code for generating Unique Random Numbers

Generating Random Numbers is quite simple. Just use the class Random and method nextInt as :
new Random().nextInt(10);
This will generate a unique random number between 0 and 9 (both inclusive). Similarly if you want to generate a unique random number between a fixed length, say 10 to 100, use can use a code something like [...]

Java code for shuffling

Many times we are required to shuffle a particular set of objects so that they may mix up properly. A standard way to shuffle any set of objects is to swap their positions randomly. The code given below does this by swapping the position of all the numbers of the array. The code uses the [...]

Java Sudoku Solver

Developing a Sudoku Solver program is perhaps the the only thing which is more interesting than solving a Sudoku puzzle.
The java code given below solves the puzzles in 4 steps :
1. If in any box, only 1 digit can be filled up, find that digit, fill up the box and proceed.
2. If a particular [...]

Recursive Permutation in Java

Finding all the permutations for any given set of items has always been an area of interest for programmers. A very simple algorithm for finding all the permutations, the Bell Algorithm and the C code implementation of that algorithm has already been presented. However the initial solution was provided using iteration.

Here the java code for [...]

Finding whether a no. is Even or Odd without using Conditional Statement

Writing a program to find whether a given number is even or odd without using any conditional statement or loop can be quite tricky. Nevertheless the program is simple and can be done in at least 2 ways.
In the first method, a 2-D array is used to store the strings “even” and “odd” in the [...]

| Shop Free Cellular Phones at Bestincellphones.com. | Thanks to Best CD Rates, iCellPhoneDeals.com Offers Best Cell Phone Deals. and Incinerador De Grasa