I have a task that I need to implement a post request from PHP to Java programming language. This is the code segment, what's the equivalent in Java? I don't know the curl\_setopt part.

```php
function send()
{
    $fieldcnt    = 6;

    $data = array(
        'UserID' => $this->username,
        'PWD' => $this->password,
        'APIKEY' => $this->apikey,
        'FROM' => $this->from,
        'TO' => $this->to,
        'MSG' => $this->msgtext
    );

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $this->base_url_SendSMS);
    curl_setopt($ch, CURLOPT_POST, $fieldcnt);
    curl_setopt($ch,CURLOPT_POSTFIELDS, http_build_query($data));
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    $res = curl_exec($ch);
    curl_close($ch);
    return $res;
}

```