I suggest you to have the Name, Age and Sex splitted by "," character.
It means:
String s = "Name:" + name + ",Age:" + age + ",Sex:" + sex;
Then you can split the string s by ","
String properties = s.split(",");
Then from properties variable, you can split by ":" to take the Property name and the value of that property.
Is that clear?
I'm adding more code to support another ways as you wanted:
String name = "Thuan";
String age = "27";
String sex = "male";
String s = "Name:" + name + "Age:" + age + "Sex:" + sex;
int nameIndex = s.indexOf("Name:");
int ageIndex = s.indexOf("Age:");
int sexIndex = s.indexOf("Sex:");
String theName = s.substring(nameIndex + "Name:".length(), ageIndex);
String theAge = s.substring(ageIndex + "Age:".length(), sexIndex);
String theSex = s.substring(sexIndex + "Sex:".length(), s.length());
System.out.println(theName);
System.out.println(theAge);
System.out.println(theSex);
Please be note that this is just example show you the logic, you need to refactor yourself.