Find ASCII value of a Character in Java

Write a program in Java to find ASCII value of a Character : ASCII or American Standard Code for Information Interchange is a character encoding standard to represent characters in computers. By using a 7 bit binary number, a character is defined. There are 128 possible characters . In decimal form, we can reprent a

Write a Java program to find current resolution of the Screen

Java program to find current Screen Resolution : In this tutorial, we will learn how to find the Screen resolution of your system. We will use ‘java.awt’ package to calculate the values. 1. Using ‘Toolkit’ class, get the screen size using ‘Toolkit.getDefaultToolkit().getScreenSize()’ method. 2. ‘getScreenSize()’ gets the size of the primary display if multiple screens

Find the most frequent element in an array using Java

Write a Java program to Find the most frequent element in an array: Most frequent element means the element that occurs most of the time in an array. To find the most frequent element, follow these steps : 1. We are using a ‘map’ to store count of each element in the given array 2.

Java program to find pairs with a given sum in an array

Java program to find pairs with a given sum in an array : Problem : One array is given with unsorted numbers. Find number of pairs of elements the sum of which is equal to a given value : Solution : 1. We will scan the array two times. 2. Create one empty HashMap first

Java 8 Tutorial : StringJoiner example

StringJoiner class in Java8 explaination with Example : ‘StringJoiner’ class was introduced in Java8 . Using this class, we can join a number of different strings easily. Two different constructs are available for ‘StringJoiner’ to instantiate it. StringJoiner(CharSequence delimiter) : It constructs a StringJoiner with the separator as ‘delimiter’. StringJoiner(CharSequence delimiter, CharSequence p, CharSequence s)

Java tutorial : Find all strong numbers in a range

Java program to check if a number is strong or not : A number is called a strong number if the sum of factorials of each digit is equal to the number. In this tutorial, we will write one java program to find out all strong numbers from 1 to 100000. You can modify this

Java program to iterate through a list using ListIterator

Iterate through a list using Listiterator in Java : We can iterate through all elements of a list using ‘Listiterator’ in Java. Main advantage of Listiterator is that you can iterate in both direction. i.e. access one by one element from first to last or from last to first. Create one list and create one

Java program to find union and intersection of two sorted Arrays

Java program to find Union and Intersection of two sorted arrays : In this tutorial, we will find the union and intersection of two sorted array elements. Let’s find out the union first : Union of two sorted arrays using Java : 1. Scan both arrays simultaneously 2. Compare element of both of the array