Posts from Java

Find Shortest path of a weighted graph where weight is 1 or 2 in Java

By Aniruddha Ghosh

In this article, we will discuss how to Find the Shortest path of a weighted graph where weight is 1 or 2 in Java. So you are given a directed weighted graph where every edge weigh.... Read More

Check if two arrays are equal or not in Java

By Neha Negi

In this tutorial, we will learn how to check if two arrays are equal or not in Java. Firstly, using a simple program and secondly using a predefined library to do the same. We will.... Read More

Create a directory if it does not exist in Java

By SAHIL NILKANTH

In this tutorial, we are going to learn how to create a new directory if it does not exist in Java. Here is the code for the following program. import java.io.File; import java.uti.... Read More

Create a Countdown in Java

By Mitun Kumar Sahu

Generally, a backward counting starting from any number to zero in a fixed interval of time(in seconds) is called a countdown. It is mostly used in exams and all to show the time r.... Read More

Check if a value exists in an Array in Java

By Mitun Kumar Sahu

To check if a value exists in an array or not in Java, we can follow 2 methods: Linear search and binary search. To use binary search, the array must be sorted. Time complexity .... Read More

Delete the last Element of an array in Java

By SAHIL NILKANTH

In this tutorial, we are going to discuss how to delete the last element from an array in Java, We’ll look at the code for both static and dynamic declaration of the array. S.... Read More

How to compare two strings lexicographically in Java

By Kamlendra Pratap Singh

Let’s learn how to compare two strings lexicographically in Java. Before proceeding with the tutorial let us understand the term ‘lexicographically‘. Lexicographi.... Read More

Sort a Java array in ascending and descending order

By Mitun Kumar Sahu

An array is a container containing many data of the same type within a single variable in a contiguous manner. It means all data can be of numbers type, string type, etc. In this .... Read More

Related Posts