C to java
I need to convert the attached C code to JAVA
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct
{
int start;
int finish;
int duration;
int conflict;
} job;
// Comparision function used to sort the job array based on
finish time.
int compare_finish_jobs(const job *job1, const job *job2)
{
if (job1->finish < job2->finish)
{
return -1;
}
if (job1->finish == job2->finish)
{
return 0;
}
return 1;
}
int main()
{
int j, k, l, m, o, p, q, r;
int finish[1000];
int start[1000];
int duration[1000];
int conflict[1000];
srand(time(0));
// Storing the count of scheduled jobs with
earliest start time for 1000 runs in an array
for (j = 0; j < 1000; j++)
{
start[j] = EarliestStartTime();
}
// Sorting the array with count scheduled jobs in
ascending order
qsort(start, 1000, sizeof(int), (int (*)(const void
*, const void *))cmpfunc);
}
C to java I need to convert the attached C code to JAVA #include #include #include typedef
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am