Found 2616 Articles for Java

JAVA Program to Find Length of Longest Chord of a Circle

Mr. Satyabrata
Updated on 27-Dec-2022 14:24:38

102 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 Replace Each Element of Array with its Next Element

Mr. Satyabrata
Updated on 27-Dec-2022 14:19:35

737 Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data types. As per the problem statement we have to replace each element of the array with its next element and we can replace the last element with the first element. Let’s start! To show you some instances − Instance-1 Suppose the original array is {2, 3, 1, 4, 6} After updating the array with its next element: {3, 1, 4, 6, 2} Instance-2 Suppose the original array is {12, 23, 11, 64} After updating the array with its next element: {23, ... Read More

Find the Area of a Circle Inscribed in a Square in Java

Mr. Satyabrata
Updated on 27-Dec-2022 14:17:25

484 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. A square consists of four sides ... Read More

JAVA Program To Convert Roman Number to Integer Number

Mr. Satyabrata
Updated on 27-Dec-2022 14:08:59

7K+ Views

Roman Number − Based on the ancient Roman system, symbols are used to represent the numbers. These numbers are known as Roman numbers. Symbols are I, V, X, L, C, D, and M use respectively for 1, 5, 10, 50, 100, 500, and 1, 000. Integer Number − Integer number is nothing but the whole number which consists ofpositive, negative and zero value. Fraction numbers are not integers. Here we have set the symbol values as per their integer values. Whenever a roman number is entered as input we divide into units and then calculate the appropriate roman number. I ... Read More

Check Whether a Number is an Autobiographical Number or Not in JAVA

Mr. Satyabrata
Updated on 27-Dec-2022 12:36:26

7K+ Views

A number is said to be an Autobiographical number, if the number’s first digit represents the number of 0 available in the given number, the second number represents the number of 1 present in the given number, the third number represents the number of 2 present in the given number and so on. In simple terms, if the given number’s digits from left to right represent the frequency of 0, 1, 2, 3, 4.... N respectively present in the given number then that number is known as Autobiographical number. Some examples of Autobiographical numbers are: 1210, 2020, 21200, 3211000, 42101000 ... Read More

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

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

5K+ 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 27-Dec-2022 12:19:16

562 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

304 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

1K+ 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

Advertisements