Hey, basically im stuck on understanding pseudo code here is the code:-

scasol is a string containing binary numbers.

This method will change a random element of the scasol field/attribute. As in the lecture notes, we will generate a random integer (say p) between 0 and n-1 (n = scasol.length()). We will then change position p of scasol, i.e. it is a '1' we make it a '0' and if it is a '0' we set it to '1'

1) Create a random integer p that ranges between 0 and n-1.
2) Create an empty new string say x.
3) Copy from elements 0 to p-1 from scasol to x.
4) Copy the changed version of position p of string scasol to x.
5) Copy from p+1 to n-1 of scasol to x.
6) Set scasol to be x.



This is what I have so far in java:-
public void SmallChange()
{
Random rand = new Random();
rand.setSeed(System.currentTimeMillis());


int n = scasol.length();
int p = Math.abs(rand.nextInt() % n);
String x;


if(n<0){

}

}


Right now I am stuck on stage 3 of the code "Copy from elements 0 to p-1 from scasol to x." I dont understand how you can copy all the elements from 0 to p-1 unless your using a list because this is a string we are dealing with can someone please help me out any help at all will be much apprechated.