I have done a curl operation using php. This is my code.
$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Basic ' . base64_encode($username . ":" . $password)));
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonObjectFields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec($ch);
curl_close($ch);
Now I need to rewrite this code in java. I am not much familler with HttpURLConnection in java. Can any body help?