// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.lang.reflect.*;

public class Ups { 
    public static void setchar(String str, int ix, char ch) throws Exception {
        Field field = String.class.getDeclaredField("value");
        field.setAccessible(true);
        Array.setChar(field.get(str), ix, ch);
    }
    public static void main(final String[] args) throws Throwable {
        String str = "alpha";
        String str2 = str.substring(0, 3);
        System.out.println(str);
        System.out.println(str2);
        setchar(str, 1, 'x');
        System.out.println(str );
        System.out.println(str2);
    }
}
