# java programs

- 03 October
### Happy Number program in Java

In this article, we are going to learn to find Happy Number using Java. Let’s first understand, what is Happy Number? What is a Happy Number? A number which leaves 1 as a result after a sequence of steps and in each step number is replaced by the sum of squares of its digit. For […]

- 30 December
### Rock Paper Scissors Game in Java

Learn about how to implement Rock Paper Scissors game in java.

- 28 September
### How to find Magic Number in Java

In this article, we are going to learn to find Magic Number using Java. Let’s first understand, what is Magic Number? What is a Magic Number? A number which leaves 1 as a result after a sequence of steps and in each step number is replaced by the sum of its digits. For example, if […]

- 18 September
### Return second last digit of given number in java

In this topic, we will learn to get the second last digit of a number in Java with the help of examples. There can be several ways to get second last digit; here we are discussing some solutions. Using modulo operator Here, we are using modulo and divide operators to find the second last digit. […]

- 05 October
### 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 or not, we need to see if it has any other factors other than 1 or itself. If it has, […]

- 06 October
### 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 – y1)^2) Here is simple program to calculate distance between two points in java. [crayon-6096e0b6134cf287715670/] Here we have used math.sqrt […]

- 06 October
### 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 can simply use inbuilt Integer.toBinaryString() method to convert a decimal [crayon-6096e0b61366a139444235/] Output: Binary representation of 12 : 1100 Binary representation […]

- 05 October
### 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 two hemisphere i.e. Northen Hemisphere and Southern Hemisphere. Formula of calculating total surface area of Hemisphere is: surface area of […]

- 05 October
### 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 * r + 2 *Π * r * h Where r is radius of cylinder and h is height of cylinder […]