public static void calculateChecksum(byte[] sysex, int start, int end, int ofs) { int i; int sum = 0; for (i = start; i <= end; i++) sum += sysex[i]; int remainder = sum % 128; sysex[ofs] = (byte)(128 - remainder);
public void calculateChecksum(Patch p) { for (int i = 0; i < PATCH_SYSEX_START.length; i++) { int checksumStart = PATCH_SYSEX_START[i] + CHECKSUM_START; int checksumEnd = PATCH_SYSEX_START[i] + PATCH_SYSEX_SIZE[i] - 3; int checksumOffset = checksumEnd + 1; calculateChecksum(p.sysex, checksumStart, checksumEnd, checksumOffset); }
  public static void calculateChecksum(byte[] sysex, int start, int end, int ofs) {    int i;    int sum = 0;    for (i = start; i <= end; i++)      sum += sysex[i];    int remainder = sum % 128;    sysex[ofs] = (byte)(128 - remainder);  }