Question: I write C code with visual studio 2008.I want to place varibles "inside" the code.Like this 

```
 int   main()
{
    foo();
    int i;
    foo(i)
    return 0;
}

```

Can I do it ?
For now this generates compile errors,despite that I compile it with /Tp option

Answer: 
Check out [NumberFormat](http://www.gwtproject.org/javadoc/latest/com/google/gwt/i18n/client/NumberFormat.html) (com.google.gwt.i18n.client.NumberFormat) in the GWT Javadoc.

I've never used it but I see this example in there:

```
// Custom format
value = 12345.6789;
formatted = NumberFormat.getFormat("000000.000000").format(value);
// prints 012345.678900 in the default locale
GWT.log("Formatted string is" + formatted);

```

So this should work for you.

**Update**
----------

This method provides the same functionality as the one in your question. I went ahead and asked for the most efficient way to go about this, see that question [here](https://stackoverflow.com/questions/7226623/most-efficient-way-to-fill-a-string-with-a-specified-length-with-a-specified-char/7226643#7226643). (Sorry this answer has been edited so much - it was just bugging me)

```
public static String getFormatted(double value, int decimalCount) {
    StringBuilder numberPattern = new StringBuilder(
            (decimalCount <= 0) ? "" : ".");
    for (int i = 0; i < decimalCount; i++) {
        numberPattern.append('0');
    }
    return NumberFormat.getFormat(numberPattern.toString()).format(value);
}

```

Alternatives include using a set amount of "0"'s and using substring to pull out the required pattern as @Thomas Broyer mentioned in the comments.
In current GWT (2.5, 2.6), there is now:

```
private final NumberFormat numberFormat = NumberFormat.getDecimalFormat();

System.out.println(numberFormat.format(myFloat));

```

Edit: added GWT versions per request