Timo N. - 1 year ago 89

Java Question

i want to turn two Integer x and y into one float like x,y

So basically 1 and 3 shud become 1,3

Not sure how to write this though:

`float z = (float) x,y;`

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

You can do this in two ways. By using string concatenation, or mathematically.

String concatenation:

```
float z = new Float(x + "." + Math.abs(y));
```

Mathematically:

```
float z = x + (y / Math.pow(10, Math.floor(Math.log10(Math.abs(y)) + 1)));
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**