Java tutorial
//package com.java2s; public class Main { public static int getInsolesMaxAngle(int insoleAxisXF, int insoleAxisYF, int insoleAxisZF, int insoleAxisXS, int insoleAxisYS, int insoleAxisZS) { int insoleAngleF = getInsoleAngle(insoleAxisXF, insoleAxisYF, insoleAxisZF); if (insoleAngleF == -1) { return insoleAngleF; } int insoleAngleS = getInsoleAngle(insoleAxisXS, insoleAxisYS, insoleAxisZS); if (insoleAngleS == -1) { return insoleAngleS; } return Math.max(insoleAngleF, insoleAngleS); } public static int getInsoleAngle(int axisX, int axisY, int axisZ) { int etalon = 4300; if (axisZ < 0) { return -1; } axisX = Math.abs(axisX); axisY = Math.abs(axisY); axisZ = Math.abs(axisZ); int maxAxis = Math.max(axisY, axisX); double maxAngle = ((double) ((axisZ - maxAxis) * 100)) / etalon; return (int) (90 - maxAngle) / 2; } }