谁能帮我这个C代码转换成JAVA,高奖励

double GetPointDistance(double point_st, double point_end) {
double y2 = point_end[1];
double y1 = point_st[1];
double x1 = point_st[0];
double x2 = point_end[0];
return sqrt((x1 - x2) (x1 - x2) + (y1 - y2) (y1 - y2));
}

double GetNearestDistance(double point, double point_st, double* point_end) {

double a = 0.0, b = 0.0, c = 0.0;

a = GetPointDistance(point_end, point);

b = GetPointDistance(point_st, point);

c = GetPointDistance(point_end, point_st);



if (a  a >= b  b + c * c) 
    return b;     
if (b  b >= a  a + c * c)  
    return a;    


float l = (a + b + c) / 2;     
float s = sqrt(abs(l  (l - a)  (l - b) * (l - c))); 
return 2 * s / c;

}

static int PolygonIsContainPoint_with_gap(double point, double polyline, int pointcount, double* middle, double gap) {
int result = -1, tempI,temp2;
if (gap != 0)
gap = gap * 11.52339 / 1000000;

double maxx = 0, minx = 0, maxy = 0, miny = 0;
if (polyline == NULL || point == NULL)
    return result;
int i;
double dis=10000.0;

int j = pointcount-1;
for (i = 0; i < pointcount; i++) {
    if (i == 0) {
        tempI = j+j;
        temp2=0;
    }
    else{
        tempI = i+i;
        temp2 = tempI-2;
    }

    dis = GetNearestDistance(point, polyline+tempI, polyline+temp2);
    if (dis <= gap) {
        ems_log_debug("spe_cal",
                "PolygonIsContainPoint gap find dis=%f <= gap=%f", dis,
                gap);
        result = 1;
        break;
    }
}

return result;

}

 你的代码首先根本也不对
double GetPointDistance(double point_st, double point_end) 
这里明显应该是指针类型,但是没有写。
if (a  a >= b  b + c * c) 
这个在c语言里也不符合语法。你得先把原始程序搞对。

你的代码无非就是把double * 改写成 double[]
别的语法和java是一样的。

“高奖励”就算了。能回答你,多少分我都会回答你。高奖励其实没什么用,那种悬赏分挺高,但是解决问题不采纳就跑了的垃圾我见多了。

另外就是sqrt和abs在java里是Math.sqrt和Math.abs