[Demonstration 1]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}

[Buggy Hunk]
protected void onCreate(Bundle savedInstanceState) {

[Patch]
protected void onCreate(Bundle savedInstanceState) throws SecurityException {

[Demonstration 2]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_add_student);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    Intent startingIntent = getIntent();
    className = startingIntent.getStringExtra("className");
    CollapsingToolbarLayout collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    Realm.init(this);
    realm = Realm.getDefaultInstance();
    collapsingToolbarLayout.setTitle(className);
    initView();
    setupRecyclerView();
    loadlocationsDatabase();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        setupWindowAnimations();
    }
    ImageView imageViewAtendance = (ImageView) findViewById(R.id.ic_attendance);
    imageViewAtendance.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(Activity_add_student.this);
            Intent intent = new Intent(Activity_add_student.this, MainActivity.class);
            intent.putExtra("class_name", className);
            startActivity(intent, options.toBundle());
        }
    });
    FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
    fab.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            showCustomView();
        }
    });
}

[Buggy Hunk]
Intent intent=new Intent(Activity_add_student.this,MainActivity.class);

[Patch]
Intent intent=new Intent(Activity_add_student.this,Attendance_Activity.class);

[Demonstration 3]

[Buggy Method]
public static int readVarInt(DataInput in) throws IOException {
    int raw = readVarIntUnsigned(in);
    // This undoes the trick in writeSignedVarInt()
    int temp = (raw << 31 >> 31 ^ raw) >> 1;
    // This extra step lets us deal with the largest signed values by treating
    // negative results from read unsigned methods as like unsigned values.
    // Must re-flip the top bit if the original read value had it set.
    return temp ^ (raw & (1 << 31));
}

[Buggy Hunk]
return temp ^ (raw & (1 << 31));

[Patch]
return temp ^ raw & 1 << 31;