Get user by id and rol

Hello, i am looking a java or a flow to help to get the user name by the id, i try several way but i don’t know how to do it. On the integration server i create i java i just need how to implement a method to get the solution. Thanks you.