encode static method

String? encode(
  1. int val
)

Decodes integer access mode to string

Implementation

static String? encode(int val) {
  if (val == INVALID) {
    return null;
  } else if (val == NONE) {
    return 'N';
  }

  var bitmask = ['J', 'R', 'W', 'P', 'A', 'S', 'D', 'O'];
  var res = '';

  for (var i = 0; i < bitmask.length; i++) {
    if ((val & (1 << i)) != 0) {
      res = res + bitmask[i];
    }
  }
  return res;
}