Code example for OAEPParameterSpec

    private static Provider cp;
    private static boolean runTest(String mdName, MGF1ParameterSpec mgfSpec,
        byte[] p) throws Exception {
        OAEPParameterSpec spec = new OAEPParameterSpec(mdName, "MGF1",
            mgfSpec, new PSource.PSpecified(p));
        cp = Security.getProvider("SunJCE");
        System.out.println("Testing provider " + cp.getName() + "...");
        AlgorithmParameters ap = AlgorithmParameters.getInstance("OAEP", cp);
        byte[] encoding = ap.getEncoded();
        AlgorithmParameters ap2 = AlgorithmParameters.getInstance("OAEP", cp);
        OAEPParameterSpec spec2 = (OAEPParameterSpec) ap2.getParameterSpec
        return compareSpec(spec, spec2);
Connect your IDE to all the code out there  Get Codota for Java