Verifing the given R/S pair (signature) against a hash using the public key According to this function:

public boolean verify(Sha256Hash sigHash, ECDSASignature signature) {
        return ECKey.verify(sigHash.getBytes(), signature, getPubKey());
    }


I do not understand which must be the content of the variable sighash.

Here is my function where the creation of signature happend:

public ECDSASignature scriptSig(Receiver r) {
        System.out.println("First step :\n");
        System.out
                .println("CREATION OF SCRIPTSIG-----OR----- OUTPUT TRANSACTION");

        r = super.getReceiver();

        Wallet rwallet = r.getReceiverWalletList().get(0);

        BigInteger R = rwallet.getClientKey().getPrivKey();
        System.out
                .println("*******************************************************");
        System.out.println(R);

        BigInteger S = new BigInteger(r.getReceiverWalletList().get(0).getClientKey().getPubKey()); // i
                                                                                // had
                                                                                // .getPubkeyHash()
        System.out
                .println("*******************************************************");
        System.out.println(S);


        // constructs a signature with the given components
        ECDSASignature receiverSig = new ECDSASignature(R, S);

        return receiverSig;
    }


and here i am trying to verify my signature:

sha256hash = new Sha256Hash(receiver.getReceiverWalletList()
                        .get(0).getClientKey().getPrivKeyBytes());
            redeemerSignature = scriptSig(receiver);


.....


if (receiver.getReceiverWalletList().get(0).getClientKey()
                        .verify(sha256hash, redeemerSignature))
                    System.out.println("The transaction finished SUCCESSFULLY");

                else
                    System.out
                            .println("The transaction finished UNSUCCESSFULLY");


I think i my problem is the right input in sha256hash = new Sha256Hash(...) instance.

Any help?
I suppose you use the BitCoinJ library.

You are not creating a signature the correct way; an ECDSASignature object should be initialized with the ECDSA signature parameters (r,s), not the actual private and public keys. The constructor you are using, implies that the ECDSA signature has been computed already, you somehow got r and s and you initiate the signature object.

To achieve your required functionality, use the doSign(Sha256Hash input, BigInteger privateKeyForSigning) method of your ECKey and the output will be your desired ECDSASignature object. 

The input on doSign should be the same with the input on verify, which is always the SHA256 of your message to be signed. If you want to spend an P2PKH output you must sign the public key, check this post for more information.