/** Runtime support class for compiled j0 programs;
 *  this class offers useful methods that can be called from j0 programs.
 */
public class Runtime {

/** print given integer
 */    
    public static void printInt(int x) {
        System.out.print(x);
    }

/** print given string
 */    
    public static void printString(String x) {
        System.out.print(x);
    }

/** print new line 
 */    
    public static void println() {
        System.out.println();
    }

/** convert given string into an array of integers. Elements of the array
 *  contain consecutive characters of the given string.
 */    
    public static int[] explode(String s) {
        int l = s.length();
        int[] chars = new int[l];
        for (int i = 0; i < l; i++) {
            chars[i] = s.charAt(i);
        }
        return chars;
    }

/** convert given array of integers to string by concatenating all 
 *  characters in the integer array.
 */    
    public static String implode(int[] chars) {
        char[] cs = new char[chars.length];
        for (int i = 0; i < chars.length; i++) {
            cs[i] = (char)chars[i];
        }
        return new String(cs);
    }

/** the length of given array of integers
 */    
    public static int intArrayLength(int[] xs) {
        return xs.length;
    }

/** the length of given array of strings
 */    
    public static int stringArrayLength(String[] xs) {
        return xs.length;
    }
}
