code: public static String fromNullTerminatedByteArray(byte[] array) {
          int stringSize = array.length;
          for (int i = 0; i < array.length; i++) {
              if (array[i] == 0) {
                  stringSize = i;
                  break;
              }
          }
  
          return new String(array, 0, stringSize);
      }
docs: Converts a null-terminated byte array into a string.
  
  @param array byte array containing a null-terminated string
  @return string from array