Let’s learn String toUpperCase() method in java. String toUpperCase() method in java String toUpperCase() method have two variants. String toUpperCase() method in java converts a string to upper case letters. Here’s the String toUpperCase() method example. public class StringToUppercaseDemo { public static void main(String[] args) { String str = “flower brackets”; String strUpper = str.toUpperCase(); System.out.println(strUpper);…

Read More String toUpperCase() method in java

Let’s learn selection sort in java. Selection sort in java In selection sort algorithm smallest element in unsorted array is shifted to its correct position in an array. The number of times sorting takes place will always be one less than the number of integer elements in an array. To select lowest element we need…

Read More Selection sort in java

Let’s learn reverse string array in java. Reverse string array in java Here’s the reverse string array program using for loop. import java.util.Arrays; public class ReverseStringArrayInJava { public static void main(String[] args) { String[] strHierarchy = new String[]{“Junior Developer”,”Senior Developer”,”Team Lead”,”Project Manager”,”Senior Manager”,”CEO”}; System.out.println(“Given string array: ” + Arrays.toString(strHierarchy)); for(int a = 0; a <…

Read More Reverse string array in java

Let’s learn how to rename file in java. How to rename file in java To rename a file renameTo() method is used of File class. Here’s the syntax of renameTo() method of File class. public boolean renameTo(File dest) renameto method returns true if and only if the renaming is succeeded; false otherwise. Many aspects of…

Read More How to rename file in java

Let’s learn random number generator in java. Random number generator in java Let’s learn how to generate random numbers in java using some built in methods and classes. Math.random() method in java Random function in java returns pseudo random double greater than or equal to 0.0 and less than 1.0. Math.random() method uses Random class…

Read More Random number generator in java

Let’s learn quicksort in java. Quicksort in java Basically quicksort is a divide and conquer algorithm. Quicksort is one of the widely used sorting algorithm. Because it is used to sort large datasets or lists. Quicksort in java implementation Below are steps on quicksort algorithm java. Given an array of numbers we want to sort…

Read More Quicksort in java