Category: java

How to Program a Tic Tac Toe Console Game in Java

I have been busy with other things, so it’s been a while since my last post. In this post I will be showing you how...

Algorithm for Reversing an Int in Java

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...

Converting Decimal to Hex in Java

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...

How to Sort Three Variables in Ascending Order.

Sorting three variables in ascending order. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19...

Convert from Decimal to Binary in Java.

This code show how to convert from decimal to binary. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 public...

File Input Validation.

This code performs file input validation by checking whether the file exist and prompting the user for the name of the file two more times,...

Binary Search with Recursion.

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...

Infix to Postfix Conversion Using Stacks and Generics.

Infix to postfix conversion takes a formula like 2 + 2 – 1, which is infix, and converts it to postfix: 2 2 + 1...

Prime Factorization with Recursion in Java.

Prime factors of a number, are all numbers that are prime and multiplied gives you the original number. Let’s take the number 20 for example,...

Total Sum of All Numbers in Array With Recursion.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 public class Tester {   //sum of...

Convert From Decimal to Binary with Recursion in Java.

Recursion has always been a confusing topic in programming. In this tutorial I’ll try to make it simple to understand, and for that I’ll use...

Prime Numbers in Java.

A prime number is a positive integer that has exactly two factors, 1 and the number itself. We know 0 is neither a positive nor...