Found 7442 Articles for Java

Check Whether a Number is a Coprime Number or Not in Java

Mr. Satyabrata
Updated on 27-Dec-2022 12:32:05

7K+ Views

Two numbers are said to be Coprime numbers, if the maximum common divisors is 1 for those two numbers. For more clarification, there might be multiple divisors for any number and in some scenarios, there are some common divisors that are also present between two number’s divisors. So, if in any case we get the maximum common divisors between two numbers are 1, then those two numbers are known as coprime numbers. Simply, it means those numbers do not have any other common factors other than 1. In other words, we can say that these two numbers are mutually prime ... Read More

Java program to check if a point is on the left or right side of a line

Mr. Satyabrata
Updated on 23-Oct-2024 17:31:00

830 Views

A line consists of an infinite number of points. In two-dimensional coordinate system we can define every point with two values i.e. X and Y. A point basically situated on the left side or right side or it can be on the line itself and this can be defined only if we have the coordinates of it. In this program we are going to use the cross-product method to find the direction of the point. Cross- Product method is used to find the third vector from two vectors by cross multiplying both the vectors. In our case if we cross ... Read More

JAVA Program to Calculate Shortest Distance from Center of the Circle to Chord

Mr. Satyabrata
Updated on 27-Dec-2022 12:14:54

413 Views

A circle is a round shape two-dimensional diagram which has no corners. Every circle has an origin point and every point on the circle maintains equal distance from the origin. The distance between the origin and a point in a circle is known as Radius of the circle. And similarly, if we draw a line from one edge to another edge of the circle and the origin is held in the middle of it, that line is known as diameter of the circle. Basically, the diameter is double of the length of the radius. Chord of the circle refers to ... Read More

JAVA Program to Calculate Radius of Circle with Given Width and Height of Arc

Mr. Satyabrata
Updated on 27-Dec-2022 15:22:47

2K+ Views

A circle is a round shape two-dimensional diagram which has no corners. Every circle has an origin point and every point on the circle maintains equal distance from the origin. The distance between the origin and a point in a circle is known as Radius of the circle. And similarly, if we draw a line from one edge to another edge of the circle and the origin is held in the middle of it, that line is known as diameter of the circle. Basically, the diameter is double of the length of the radius. Arc of the circle refers ... Read More

Java Program to Convert Octal to Hexadecimal

Mr. Satyabrata
Updated on 08-Jul-2024 14:11:19

2K+ Views

Octal Number Octal number is also one of the number systems available. The octal number is represented with 8 digits which is from 0 to 7(0, 1, 2, 3... 7). The octal numbers are expressed as base-8 in the numeral system. Hexadecimal Number Hexadecimal number is also one of the number systems available. The hexadecimal number is represented with 16 digits which is from 0 to 15(0, 1, 2, 3... 15). From 10 to 15 it is represented as A to F. The hexadecimal numbers are expressed as base-16 in the numeral system. Problem Statement First convert the octal ... Read More

JAVA Program to Calculate Length of Chord of the Circle

Mr. Satyabrata
Updated on 27-Dec-2022 11:59:13

357 Views

A circle is a round shape two-dimensional diagram which has no corners. Every circle has an origin point and every point on the circle maintains equal distance from the origin. The distance between the origin and a point in a circle is known as Radius of the circle. And similarly, if we draw a line from one edge to another edge of the circle and the origin is held in the middle of it, that line is known as diameter of the circle. Basically, the diameter is double of the length of the radius. Chord of the circle refers to ... Read More

JAVA Program to Convert Octal to Binary

Shriansh Kumar
Updated on 01-Aug-2024 10:56:06

1K+ Views

Both binary and octal are types of number systems with the base value 2 and 8, respectively. This article aims to explain how to convert octal to binary in Java, which is one of the frequently asked interview questions. A number system is a way of representing numbers. Each type of number system has a different base value which depends on the number of digits contained by them. What is Binary Number System? There are four types of number systems available. Binary numbers are one of them. It is represented with two digits i.e. one (1) and zero (0). The ... Read More

Java program to convert binary to octal

Mr. Satyabrata
Updated on 02-Aug-2024 18:19:48

2K+ Views

Binary Number − There are many types of number systems depending upon the base value. Binary numbers are one of them. The Binary number is basically represented by two digits i.e. one (1) and zero (0). The binary numbers are expressed as base-2 in the numeral system. Octal Number − Octal number is also one of the number systems available. The octal number is represented with 8 digits which is from 0 to 7(0, 1, 2, 3... 7). The Octal numbers are expressed as base-8 in the numeral system. Here we are converting the Binary number to an octal number ... Read More

Java Program to Convert Hexadecimal to Binary

Mr. Satyabrata
Updated on 23-Jul-2024 18:32:23

2K+ Views

Binary Number − There are four types of number systems available. Binary number is one of them. The Binary number is represented by two digits i.e. one (1) and zero (0). The binary numbers are expressed as base-2 in the numeral system. Hexadecimal Number − Hexadecimal number is also one of the number systems available. The Hexadecimal number is represented with 16 digits which is from 0 to 15(0, 1, 2, 3... 15). From 10 to 15 it is represented as A to F. The Hexadecimal numbers are expressed as base-16 in the numeral system. Here we convert the hexadecimal ... Read More

How To Check Whether a Number is Tech Number or Not in Java?

Mr. Satyabrata
Updated on 09-Dec-2022 10:27:19

8K+ Views

A number is said to be a tech number, when an even digit number is divided into exactly two parts and the square value of the sum of those two numbers is equal to the original number. For more clarification, we take a number which has even digits. After that, divide it into two parts and add two parts. After getting the sum value, we calculate the square of it. Now we compare both the calculated square value and the original/input number. If both are same then we can say that the input number is a tech number otherwise ... Read More

Advertisements