The finite difference method for boundary-value problems with weak solutions