<code>
public
class
AddressUtilDemo {
public
static
void main(String[] args){
AddressUtil AddressUtil =
new
AddressUtil();
AddressUtil.setAddress(
"3454.234,24l.432"
);
System.out.println(AddressUtil.getX());
System.out.println(AddressUtil.getY());
}
}
class
AddressUtil {
private
String address;
public
AddressUtil(){}
public
AddressUtil(String address){
if
(address.indexOf(
","
)>0){
this.address = address;
}
}
public
Double getX(){
String string = address.substring(0, address.indexOf(
","
)) ;
return
Double.parseDouble(string);
}
public
Double getY(){
String string = address.substring((address.indexOf(
","
)+1));
return
Double.parseDouble(string);
}
public
String getAddress() {
return
address;
}
public
void setAddress(String address) {
this.address = address.trim();
}
}</code>