<prompt> Kuandika kazi Java kutatua: Kutokana na idadi kamili num, kurudi kamba kuwakilisha uwakilishi wake hexadecimal. Kwa idadi kamili hasi, twos njia ya kuongeza hutumiwa. herufi zote katika string jibu lazima herufi ndogo, na hapaswi kuwa na zero yoyote ya kuongoza katika jibu isipokuwa kwa zero yenyewe. Kumbuka: Wewe si kuruhusiwa kutumia yoyote kujengwa katika njia maktaba ya moja kwa moja kutatua tatizo hili.  <response>: Heres an example Java function that solves the problem using a bit manipulation approach:public static String toHexint num if num 0 return 0; char hexChars 0123456789abcdef.toCharArray; StringBuilder stringBuilder new StringBuilder; while num ! 0 int digit num 0xf; stringBuilder.appendhexCharsdigit; num 4; return stringBuilder.reverse.toString;Heres how it works:- First, we handle the special case of num being 0 by returning 0.- We initialize a char array containing the 16 possible hexadecimal characters 0-9, a-f and a StringBuilder to store the resulting string.- We loop until num is 0, extracting the last 4 bits of num which corresponds to a hexadecimal digit using a bitwise AND operation with the number 0xf. We then append the corresponding character to the StringBuilder and shift num to the right by 4 bits.- Finally, we reverse the order of the characters in the StringBuilder and convert it to a string.Note that we use the unsigned right shift operator instead of the regular right shift operator to ensure that the sign bit leftmost bit is always 0. This is important for handling negative numbers correctly in twos complement form. 