That's not related to java, it's just the curl syntax.

In order to do this you need to register you application here: http://www.twitch.tv/settings/connections, for your redirect url use http://localhost, you will need your client id to request an oath token (which is what your script uses).

To obtain the oath token use this link, make sure to replace the client id from the last step. You will be directed to a broken link, copy the access_token value from the address bar.
Quote:
https://api.twitch.tv/kraken/oauth2/authorize?response_type=token&client_id=your_client_ID&redirect_uri=http://localhost/&scope=channel_read+channel_editor


This $json script is required for use: http://www.mircscripts.org/comments.php?cid=4407

Replace the user_name and access_token in the beginning of the script. You may consider reading this token from a separate file so that it's not contained within the script.

Code:
alias -l twitch.token {
  if ($1 == user_name) return access_token
}

on @*:text:!topic*:#:{
  if ($2 != $null) {
    if ($nick isop #) twitch.topic # $2-
  }
  else {
    twitch.topic #
  }
}

alias twitch.topic {
  var %chan = $1, %topic = $2-
  var %sockname = twitch.topic. $+ $ticks
  hfree -w %sockname | hmake %sockname
  hadd %sockname headerfile %sockname $+ .header.txt
  hadd %sockname datafile %sockname $+ .data.txt
  hadd %sockname params %chan
  hadd %sockname oath.token $twitch.token($mid(%chan,2-))
  hadd %sockname request /kraken/channels/ $+ $mid(%chan,2-)
  if (%topic != $null) {
    hadd %sockname method PUT
    hadd %sockname data channel[status]= $+ $urlencode(%topic)
    hadd %sockname signal topic.set
  }
  else {
    hadd %sockname method GET
    hadd %sockname signal topic.get
  }
  sockopen -e %sockname api.twitch.tv 443
}

on *:signal:topic.get:{
  var %err = $1, %sockname = $2, %header = $3, %data = $4, %chan = $5

  if (* 200 OK iswm $read(%header,1)) msg %chan Status: $json(%data,status)
  else msg %chan Could not get status.

  hfree -w %sockname
  .remove %header | .remove %data
}

on *:signal:topic.set:{
  var %err = $1, %sockname = $2, %header = $3, %data = $4, %chan = $5

  if (* 200 OK iswm $read(%header,1)) msg %chan Status set: $json(%data,status)
  else msg %chan Could not set status.

  hfree -w %sockname
  .remove %header | .remove %data
}

on *:sockopen:twitch.*:{
  var %a = sockwrite -n $sockname
  %a $hget($sockname,method) $hget($sockname,request) HTTP/1.1
  %a Host: api.twitch.tv
  %a Connection: close
  %a Accept: application/vnd.twitchtv.v2+json
  if ($hget($sockname,oath.token) != $null) %a Authorization: OAuth $v1
  if ($hget($sockname,data) != $null) {
    %a Content-Type: application/x-www-form-urlencoded
    %a Content-Length: $len($v1)
  }
  %a $+($crlf,$hget($sockname,data))
}

on *:sockread:twitch.*:{
  var %header
  var %headerfile = $hget($sockname,headerfile)
  var %datafile = $hget($sockname,datafile)

  if (!$hget($sockname,header.complete)) {
    sockread %header
    while (%header != $null) {
      write %headerfile %header
      sockread %header
    }
    if ($sockbr) hadd $sockname header.complete $true
  }
  if ($hget($sockname,header.complete)) {
    sockread &read
    while ($sockbr) {
      bwrite %datafile -1 -1 &read
      sockread &read
    }
  }
}

on *:sockclose:twitch.*:{
  var %header = $hget($sockname,headerfile)
  var %data = $hget($sockname,datafile)
  var %signal = $hget($sockname,signal)
  var %params = $hget($sockname,params)

  if (%signal) .signal %signal 0 $sockname %header %data %params
  else {
    hfree -w $sockname
    .remove %header | .remove %data
  }
}

alias urlencode return $regsubex($1-,/([^A-Z0-9])/gi,$+(%,$base($asc(\1),10,16)))


And I don't even use this site