Instead of rewriting the code you should simply include the Apache commons codec module into your classpath. This has the exact method signature, Base64.encodeBase64(byte[]). And yes, just hitting "encodeBase64" in an internet search should be enough.
Note that your project may use other functionality from that same codecs package. So you should always first try and find the modules / libraries used by a project before you start replacing the code. And sometimes there are subtle differences between implementations, which could make the project fail in the right circumstances.
That said, the code in the question does of course not make sense. You could use encodeBase64String to directly convert to String without having to convert to bytes and then to String. And for newer level API's there is indeed the java.util.Base64 class, as mentioned in the other answer. Finally - and more importantly - if x already contains a string, why would you base 64 encode it?
Base64from?import java.util.Base64;as suggested =/