Quick Java code snippet to show Linear / Sequential Search. import java.util.Scanner; public class LinearSearchExample { public static void main(String…
How to change upper case string to lower case in Java
Quick Java code snippet to change case of a String in Java. It uses toUpperCase() and toLowerCase() methods present in java.lang.String class to convert…
String length and trim string in java
Code snippet explains the usage of String class length and trim() method. The length() method returns the length of this string. The trim() method…
Insertion sort example in Java
Code snippet to sort array using insertion sort algorithm in java. public class InsertionSortExample { static int step = 1;…
Reverse of String in Java
Quick Java code snippet to reverse java string using for loop. import java.util.Scanner; class ReverseString { public static void main(String…
String Concatenation Test in Java
Sample Java program to concatenate two strings using plus (+) concatenation operator. public class StringConcatination { public static void main(String…
How to Test String Equality in Java ?
Sample program to test String Equality in Java using equals to (==) operator and String.equals() method. public class StringEqualsTest {…
Sort Array ascending or descending using comparator in Java
Quick Java code snippet to sort Array ascending or descending using comparator in Java. import java.util.Arrays; import java.util.Comparator; public class…
Introduction to JSON Basics
JSON (JavaScript Object Notation) is one of the most popular and widely accepted data exchange format originally specified by Douglas Crockford. It…
Normalize all whites paces from string
Java provides the StringBuffer and String classes, and the String class is used to manipulate character strings that cannot be…