Hi, I have a project but I'm stuck in a couple of lines. I'm interested, as the title says, to enter a character in a position of some new chain.
The program what it does is that it is printing characters but I want them to be saved in a chain 1 to 1 in position 0, 1, 2, ... until the end of the for I am using.
for(int i=0; i<data.length(); i++){
int Ascii=Dia;
Ascii= Ascii + data.charAt(i);
for(int k=8, Pot ; k>=0; k--){
Pot=(int) Math.pow(2, k);
if(Ascii>=Pot){
System.out.print("1");
Ascii=Ascii-Pot;
}else{
System.out.print("0")
}
}
}
In the code that I share, I would like to modify the system.out that is inside the if and modify it to save it in a chain one by one. In another part of the program I do the same but this time it's a char instead of a number