Home

Java Program To Check If The Given Number is Prime or Not

In this tutorial, we will see a Java program to check if the given number is prime or not. What is a Prime Number? A number that can be divided exactly only by itself and 1. For example 7, 17 and 41. Java Program To Check If The Given Number is Binary Or Not public class PrimeNumber { public static void main(String[] args) { in...

Read more

Java Program To Check If The Given Number is Binary Or Not

In this tutorial, we will see a Java program to check if the given number is binary or not. We can check if the given number is binary or not by the following ways Checking if the number contains a 1 or 0 digits by the reminder and divide method Convert the number to String 1. Java program to check if the given number is binary or not b...

Read more

Java Program To Print An Array.

In this tutorial, we will see how to print an array In Java. We can print an array using the following 3 ways Print an array using for loop Print an array using Arrays.toString() Print a multi-dimensional array using ` Arrays.deepToString()` Print an array using Java 8 Streams 1. Print an array using for loop Here, we are iterating...

Read more

Java Program To Check If the given String Is A Number or Not

In this tutorial, we will see a Java program to check if the given String is a number or not. We can check it using the regex expression. Java Program To Check If the Given String is Number or Not Using Regex Expression In the below program, we have simply used the regex expression to check whether the given string is numeric or not. The reg...

Read more

Java Program To Calculate Sum Of All Digits Of A Number

To calculate the sum of all digits of a number First, we will get a reminder of the input number by the modulo operator (%) and add it to the sum variable. Second, we will divide the input number by 10 and assign it again to an input number variable. We will repeat the above process until the input number is not equal to zero. At the e...

Read more