Codice PHP:
import java.io.*;
import java.text.*;

public class 
Test {
     public static 
void main(String[] args)
     {
         
double x;
         if(
args.length 1)
             return;
         try
         {
             
String s args[0];
             
DecimalFormat df = new DecimalFormat();
             
Number n df.parse(s);
             
x=n.doubleValue();
         }
         catch (
ParseException e) {x=0; }
         
System.out.println(x);
     }