Transfer String to byte of specified length in Java []

find a method. The parameter is that String and length,length are to be converted to the length of byte [], and the result bit is returned to this byte []. There is an example of int to byte []. The desired result is to replace int with the input parameter of String. Please help!

example is as follows:
public static byte [] intToBytes (int value, int len) {

    byte[] b = new byte[len];
    for (int i = 0; i < len; iPP) {
        b[i] = (byte) ((value >> 8 * i));
    }
    return b;
}
Jun.29,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea4f86-1d1c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea4f86-1d1c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?