URL url = new URL(SERVER_ADRESS);
Map<String,Object> paramss = new LinkedHashMap<>();
paramss.put("werta", finished_werta);
paramss.put("wertb", finished_wertb);
StringBuilder postData = new StringBuilder();
for (Map.Entry<String,Object> param : paramss.entrySet()) {
if (postData.length() != 0) postData.append('&');
postData.append(URLEncoder.encode(param.getKey(), "UTF-8"));
postData.append('=');
postData.append(URLEncoder.encode(String.valueOf(param.getValue()), "UTF-8"));
}
byte[] postDataBytes = postData.toString().getBytes("UTF-8");
HttpURLConnection urlc = (HttpURLConnection) url.openConnection();
urlc.setRequestMethod("POST");
urlc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
urlc.setRequestProperty("Content-Length", String.valueOf(postDataBytes.length));
urlc.setConnectTimeout(CONNECTION_TIMEOUT);
urlc.setReadTimeout(CONNECTION_TIMEOUT);
urlc.setDoOutput(true);
urlc.setDoInput(true);
urlc.getOutputStream().write(postDataBytes);
BufferedReader in = new BufferedReader(new InputStreamReader(urlc.getInputStream()));
StringBuilder sb = new StringBuilder();
String output;
while ((output = in.readLine()) != null)
sb.append(output);
String result = sb.toString();
JSONObject jObjectv = new JSONObject(result);