Skip to main content

Posts

Showing posts with the label dynamic

Setting JVM Heap size at runtime

To set the JVM heap size, compile the program normally. For example, consider Runtime.java program. Compilation: javac Runtime.java Now, to set minimum heap size(let, 16 MB) required by JVM, run the program as follows : java -Xms16m Runtime  We can also restrict maximum size(let 512 MB) utilized by JVM: java -Xmx512m Runtime  Both these options can also be combined to specify upper and lower bounds of JVM heap size: java -Xms16m -Xmx512m Runtime Now you can run a program that requires huge computational space.

Words formed by selecting one letter from each set (set combinations)

//Input 1,2   3,4,5  6  -1  each set is entered line-by-line //-1 is the end of input //output will be 136,146,156,236,246,256 import java.io.*; import java.util.*; import java.lang.String; import java.util.StringTokenizer; public class Possibilities {     public static void main(String[] args) throws IOException {         String s;         ArrayList<String> a1 = new ArrayList<String>();         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));         s = br.readLine();         if (!s.equals("-1"))             a1 = generatePossibilities(s);         System.out.println(a1);     }     public static ArrayList<String> generatePos...