# java programs Archive

## Print prime numbers from 1 to 100 in java

In this program, we will print prime numbers from 1 to 100 in java. A prime number is a number which has only two divisors 1 and itself. To check if the number is prime …

## Implement distance formula in java

In this post, we will see how to implement distance formula between two points in java. Formula to find distance between two points ( x1, y1) and (x2 , y2) is d= sqrt( (x2-x1)^2+ (y2 …

## Convert decimal to binary in java

In this post, we will see how to convert decimal to binary in java. There are lot of ways to convert decimal to binary in java.Let’s explore them one by one. Using Integer.toBinaryString() method You …

## calculate total surface area of Hemisphere in java

In this post, we will see how to calculate total surface area of Hemisphere in java. Hemisphere is exactly half of sphere. There can be many practical examples of Hemisphere. You can divide earth into …

## Calculate total surface area of Cylinder in java

In this post, we will see how to calculate total surface area of Cylinder in java. Formula of calculating total surface area of Cylinder is: Surface area of Cylinder = 2 *Π * r * …

## FizzBuzz program in java

In this post, we will see how to program FizzBuzz in java. Fizzbuzz is a fun game played generally by school children.It is simple game in which when your turn comes, you need to say …

## Print pyramid pattern: 1 3*2 4*5*6 pattern in java

In this post, we will see how to print the following pyramid pattern. Problem Input : n = 4 Output : 1 3*2 4*5*6 10*9*8*7Input : n = 5 Output : 1 3*2 4*5*6 10*9*8*7 …

## Longest Substring Without Repeating Characters

In this tutorial, we will see Find Longest Substring Without Repeating Characters in java. Problem We need to find Longest Substring Without Repeating Characters Solution Brute force solution Find all the substring and check the …

## Java program to find permutation and combination (nCr nPr)

In this tutorial, we will see java program to find permutation and combination. Permutation is represented as nPr and Combination is represented as nCr.It is simple program which involves factorial of the numbers. Here is …

## Reverse number in java

In this post, we will see how to reverse a number in java. Here is simple program to reverse a number. Output: Enter a Number : 4567 Reverse of the number : 7654 Let’s …