What do you want to save?
Add Code snippet
New code examples
-
Java 2022-03-27 21:35:04
Sort string array in case insensitive order and case sensitive order java
import java.util.Arrays; public class SortStringArrayDemo { public static void main(String[] args) { String[] fruits = new String[5]; fruits[0] = "Mango"; fruits[1] = "cherries"; fruits[2] = "Apple&q... Add solution -
Other 2022-02-03 11:36:54
maximum number from Array
---without sort method--- public static int maxValue( int[] n ) { int max = Integer.MIN_VALUE; for(int each: n) if(each > max) max = each; return max; ---with sort method--- public static int maxValue( int[] n ) { Arrays.sort( n ); return... Add solution -
Java 2022-02-02 12:10:52
java overloading
Overloading mean same method name and different parameter, it can happen in same class. it's a feature that allows us to have more than one method with same name. Example: sort method of Arrays class Arrays.sort(int[] arr) Arrays.sort(String[] arr) ...... Add solution -
Java 2021-11-20 06:00:16
calculating the percentile in java
public static long[] percentiles(long[] latencies, double... percentiles) { Arrays.sort(latencies, 0, latencies.length); long[] values = new long[percentiles.length]; for (int i = 0; i < percentiles.length; i++) { int index = (int) ... Add solution -
Java 2021-10-27 12:43:05
java file sorting using date or time
public class ExampleSortFilesByDate { public static void main(String[] args) { File dir = new File("d:\\test"); File[] files = dir.listFiles(); System.out.println("-- printing files before sort --"); printFile... Add solution