I am making a new conversion software to hide messages (for fun). I have made a Binary and Decimal conversion class and my idea is, a user inputs string, it converts all to Binary format. Then splits it in half, converts one half to decimal, then adds the string back together again to make it a mix of binary and decimal. In other versions I will add more conversions, more splits,and maybe convert to languages too. I need splitting the string in half. This is my code so far::
public ray() {
Scanner in = new Scanner(System.in);
while (true) {
System.out.println("Please input the text you wish to encode!");
System.out.println("Type '#' to quit the Software.");
String s1 = in.nextLine();
if ("#".equalsIgnoreCase(s1)) {
System.out.println("Goodbye, hope you enjoyed RAYConversion v1.0 Alpha.");
// close software
}
// convert all to binary
binary Binary = new binary();
//what i need to do is split stirng s1 in half, make it into different strings. Then I will convert
//the two strings to binary and decimal. I made a converter for that.
}
}
final int mid = s1.length() / 2; //get the middle of the String
String[] parts = {s1.substring(0, mid),s1.substring(mid)};
System.out.println(parts[0]); //first part
System.out.println(parts[1]); //second part