Found 7442 Articles for Java

How to Check if the Given Arrays are Disjoint in Java?

Mr. Satyabrata
Updated on 05-Jan-2023 14:07:53

654 Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to check if the given arrays are disjoint. An array is said to be disjoint if two arrays have no element in common i.e. elements in the first array are not equal to elements in the second array. Let’s explore the article to see how it can be done by using Java programming language. To Show You Some Instances Instance-1 Suppose the original two arrays are {13, 44, 11, 19, 3} and {7, 12, ... Read More

How to Check if an Array is Empty or Not in Java

Mr. Satyabrata
Updated on 06-Aug-2024 22:31:39

18K+ Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to check if an array is empty or not. An array is said to be an empty array, if the array has zero element or no element in it. Let’s explore the article to see how it can be done by using Java programming language. InstancesTo show you some instances: Instance-1 Suppose the original array is {1, 3}. After checking if it is empty or not the result will be − Array is ... Read More

Get the Triplets in an Array Whose Sum is Equal to a Specific Number in Java

Mr. Satyabrata
Updated on 19-Jan-2023 12:05:08

766 Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to get all the triplets in the array whose sum is equal to a specific number. Here triplets refer to any three elements of the array which meet a specific condition. Note − The array must be an integer array. Let’s explore the article to see how it can be done by using Java programming language. To Show You Some Instances Instance-1 Suppose the original array is {3, 4, 25, 6, 13, 9}. ... Read More

Find difference between first and second largest array element in Java

Mr. Satyabrata
Updated on 05-Jan-2023 12:42:16

2K+ Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to find the difference between the first largest and second largest number present in an array. Note − The array must be an integer array. Let’s explore the article to see how it can be done by using Java programming language. To Show You Some Instances Instance-1 Suppose the original array is {22, 45, 1, 10, 52, 27} After performing the operation, the result will be − The second largest element of an ... Read More

Find sum of two array elements index wise in Java

Mr. Satyabrata
Updated on 05-Jan-2023 12:39:23

20K+ Views

In Java, Array is an object. It is a non-primitive data type which stores values of similar data type. As per the problem statement we have to find the sum of two different arrays with respect to index and store it into a third array. Suppose a1[] is first array, a2[] is second array and a3[] is third array, then sum of a1[] and a2[] should be stored in a3[] i.e. a1[0] + a2[0] = a3[0] a1[1] + a2[1] = a3[1] a1[2] + a2[2] = a3[2] and so on. Let’s start! Note − Two array lengths must be the ... Read More

Find count of positive and negative array elements in Java

Mr. Satyabrata
Updated on 05-Jan-2023 12:37:04

8K+ Views

In Java, Array is a non-primitive data type which stores values of similar data type. As per the problem statement we have to find count of positive numbers, negative numbers and zero present in the given array. Any number which is greater than zero that is called as positive number, if the number is less than zero then that is negative number else the given number is a zero. Let’s see how we can do it by using Java programming language. To Show You Some Instances Instance-1 Suppose the original array is {2, 0, -1, 4, -6} In the ... Read More

Find Duplicate Elements and its Frequency in an Array in Java

Mr. Satyabrata
Updated on 05-Jan-2023 12:28:38

21K+ Views

In Java, Array is a non-primitive data type which stores values of similar data type. As per the problem statement we have to detect the elements which are repeating in an array and print its frequency. An array can contain duplicate values as well. So, the number of times an element is present in an array, that is called frequency of the element in the array. Let’s see how we can do it by using the Java programming language. To Show You Some Instances Instance-1 Suppose the original array is {2, 3, 5, 4, 3, 1, 3, 2, 1, 2, ... Read More

Find Angle at Circumference from Angle at Centre by a Chord in Java?

Mr. Satyabrata
Updated on 05-Jan-2023 12:24:23

107 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

Find Angle while Angle by similar Chord at center in Java

Mr. Satyabrata
Updated on 05-Jan-2023 12:33:22

142 Views

A circle is a round shape two-dimensional diagram that has no corners. Every circle has an origin point and every point on the circle maintains an equal distance from the origin. The distance between the origin and a point in a circle is known as the 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 the diameter of the circle. Basically, the diameter is double of the length of the radius. The chord of ... Read More

Find Angle at Centre from Angle at Circumference by an Arc in Java?

Mr. Satyabrata
Updated on 05-Jan-2023 12:10:40

220 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 to ... Read More

Advertisements