What is the equivalent java function of encoder.encode . I want to convert following JavaScript funtion to java .
function fun(){
const encoder = new TextEncoder()
const view = encoder.encode('xxx').buffer
console.log(view);
}
but the thing is couldn't find any equivalent code to get similar result