Question: I want to convert Int to ternary base
Like this:

```
42 -> 1120

```

What is the best way to do it in Scala?

Answer: 
You can use `java.lang.Integer.toString(n, radix)`:

```
Integer.toString(42, 3)

```
Use Java's [`Integer#toString(int, int)`](http://docs.oracle.com/javase/8/docs/api/java/lang/Integer.html#toString-int-int-) method:

```
scala> Integer.toString(42, 3)
res0: String = 1120

```