Found 7442 Articles for Java

Java Program to Find Common Elements Between Two Arrays

Shiva Keerthi
Updated on 31-May-2024 15:06:05

11K+ Views

We can use different approaches in Java to Find Common Elements between two arrays. We will discuss the approaches, including the basic steps involved, and provide the necessary code to achieve our goal. Whether you are a beginner or an experienced Java programmer, this article will provide you with the tools and knowledge necessary to solve this common programming problem. In this article, we will learn different ways of finding the common elements between two arrays. Examples for Common Elements Between Two Arrays: Example 1: Input: array1 = {4, 2, 3, 1, 6} array2 = {6, 7, 9, ... Read More

Java program to find cube root of a number using binary search

Shiva Keerthi
Updated on 30-Aug-2024 11:41:47

1K+ Views

The cube root of a number is an integer value when multiplied by itself thrice, giving the original number. In this article, we are going to write a Java program to find the cube root of a number using binary search. Finding the cube root of a number is one of the applications of the binary search algorithm. We will discuss in detail how we calculate the cube root using a binary search algorithm in Java. Problem Statement Write a Java program to find the cube root of a number using Binary Search − Input 1 64 Output 1 4 ... Read More

Java Program to Find Area of circle Using Method Overloading

Shiva Keerthi
Updated on 09-Jul-2024 12:23:14

2K+ Views

We can calculate the area of the circle in Java using Method Overloading. “Method Overloading” is a feature in Java that allows one to write more than one method in the same class using the same method name. It will enable us to declare more than one method with the same names but with different signatures i.e., the number of parameters in the method may be different or the datatype of parameters may be different. Now, let us achieve Method Overloading in Java by considering the “area of a circle” as an example. Before moving to an example, now ... Read More

Best Practices for Deploying Hadoop Server on CentOS/RHEL 8

Satish Kumar
Updated on 10-Apr-2023 10:50:32

590 Views

Hadoop is an open-source framework that is used for distributed storage and processing of large datasets. It provides a reliable, scalable, and efficient way to manage Big Data. CentOS/RHEL 8 is a popular Linux distribution that can be used to deploy a Hadoop server. However, deploying Hadoop on CentOS/RHEL 8 can be a complex process, and there are several best practices that should be followed to ensure a successful deployment. In this article, we will discuss best practices for deploying a Hadoop server on CentOS/RHEL 8. We will cover following sub-headings − Pre-requisites for Deploying Hadoop on CentOS/RHEL 8 ... Read More

Best Java IDE’s for Linux Developers

Satish Kumar
Updated on 10-Apr-2023 10:41:25

2K+ Views

Java is one of most popular programming languages in world. With its easy-to-read syntax and platform independence, it has become a favorite among developers. Linux is also a popular operating system for developers due to its flexibility and open-source nature. Combining two makes for a powerful combination. In this article, we will discuss best Java IDEs for Linux developers. What is an IDE? An Integrated Development Environment (IDE) is a software application that provides a comprehensive environment for coding, debugging, and testing software applications. It is a one-stop-shop for developers who want to write, test, and deploy code all in ... Read More

Java Program to Find the GCDs of given index ranges in an array

Rudradev Das
Updated on 06-Apr-2023 15:22:34

273 Views

In the field of data structure, a range query is a pre-processing method to operate on some input data in an efficient manner. A range query is responsible to answer any query of the particular input on any data subset. If we want to copy some data columns from a table we need to maintain an index for that particular dataset. An index is a direct link or a key, which is designed to provide an efficient searching process in a data set. It is mainly used to speed up the data retrieving from a lost data source. In mathematics, ... Read More

Java program to find array sum using bitwise OR after splitting given array in two halves after K circular shifts

Rudradev Das
Updated on 06-Apr-2023 18:00:21

220 Views

Array is a set of a single non primitive similar data types (values or variables) that stores the elements in a memory with a fixed number of values. After creating an array with certain elements, the length of this data set became fixed. Here non primitive means, these data types can be used to call a method to perform a particular operation which can be null in character. Here the bitwise sum means, sum of certain numbers with an exactly 2 bits set. Bitwise OR denotes that each integer is present in a subarray. It is an adjacent non-void element ... Read More

Java Program to count inversions of size three in a given array

Rudradev Das
Updated on 23-Jan-2025 23:06:37

289 Views

In this article, we will learn how to count inversions of size three in a given array. The goal is to find how many triplets (i, j, k) exist such that i < j < k and arr[i] > arr[j] > arr[k].Understanding Inversion Count Inversion count is a step-counting method by which we can calculate the number of sorting steps taken by a particular array. It is also capable of counting the operation time for an array. But, if we want to sort an array in a reverse manner, the count will be the maximum number present in that array. Array: ... Read More

Java program to extract a single quote enclosed string from a larger string using Regex

Pranay Arora
Updated on 16-Sep-2024 23:24:33

1K+ Views

Regex or Regular Expression is the language used for pattern-matching and string manipulation. It consists of a sequence of characters that define a search pattern and can be used for performing actions like search, replace, and even validate on text input. A regular expression consists of a series of characters and symbols that amount to form a search pattern. In this article, we are going to see how to write a Java program to extract a single quote-enclosed string from a larger string using Regex. Java provides support for regex from the java.util.regex package. The pattern class represents a compiled ... Read More

Java Program to Display Name of the Weekdays in Calendar Year

Shriansh Kumar
Updated on 30-Sep-2024 15:56:38

746 Views

There are 5 weekdays in a week, which are Monday, Tuesday, Wednesday, Thursday and Friday. The two remaining days i.e. Saturday and Sunday make up the weekend. In this article, we will learn how to write a Java program to display name of the weekdays in a calendar year. Using the DateFormatSymbols Class The Java standard library's java.text package contains the DateFormatSymbols class which provides methods for retrieving and setting the following date and time symbols − Month and day names and abbreviations Day of the week names and abbreviations Era names AM/PM strings Time Zone Names and ... Read More

Advertisements