private static void connectBlocks(List<BasicBlock> lstbb, Map<Integer, BasicBlock> mapInstrBlocks) {

    for (int i = 0; i < lstbb.size(); i++) {

      BasicBlock block = lstbb.get(i);
      Instruction instr = block.getLastInstruction();

      boolean fallthrough = instr.canFallThrough();
      BasicBlock bTemp;

      switch (instr.group) {
        case CodeConstants.GROUP_JUMP -> {
          int dest = ((JumpInstruction)instr).destination;
          bTemp = mapInstrBlocks.get(dest);
          block.addSuccessor(bTemp);
        }
        case CodeConstants.GROUP_SWITCH -> {
          SwitchInstruction sinstr = (SwitchInstruction)instr;
          int[] dests = sinstr.getDestinations();

          bTemp = mapInstrBlocks.get(((SwitchInstruction)instr).getDefaultDestination());
          block.addSuccessor(bTemp);
          for (int dest1 : dests) {
            bTemp = mapInstrBlocks.get(dest1);
            block.addSuccessor(bTemp);
          }
        }
      }

      if (fallthrough && i < lstbb.size() - 1) {
        BasicBlock defaultBlock = lstbb.get(i + 1);
        block.addSuccessor(defaultBlock);
      }
    }
  }
private static void connectBlocks(List<BasicBlock> lstbb, Map<Integer, BasicBlock> mapInstrBlocks)