I am working on a project but I am stuck at one point. I want the result string always to be 128 characters long. When my String is shorter, I want to replace it with "0"s. I tried many ways but none of them worked so I decided to ask it here.
This is something I have tried:
String s = "This is a String!";
if(s.length() < 128){
s.replace(s.length(), 128, "0");
System.out.println(s);
}