convert this code to java language
/*C-Preprocessor*/ #include #include #include #include #include #include #include /* constants*/ #define PAGES 256 #define PAGE_MASK 255 #define PAGE_SIZE 256 #define OFFSET_BITS 8 #define OFFSET_MASK 255 #define MEMO_SIZE PAGES * PAGE_SIZE #define BUF_SIZE 10 /* physicall page number*/ int pagetable[PAGES]; signed char main_Memo[MEMO_SIZE]; signed char *backing_ptr; int main(int argc, const char *argv[]) { /*check if the user entered 3 arguments otherwise exit*/ if (argc != 3) { printf( "Please enter 3 args: <./file_exe_name> "); exit(0); } /* This will fill all the page table with -1*/ for (int i = 0; i < PAGES; i++) { pagetable[i] = -1; } int total_addr = 0,pageFault = 0; const char *file_name = argv[1]; const char *input_file = argv[2]; const char *output_file = "output.txt"; int backing_ptr_fd = open(file_name, O_RDONLY); backing_ptr = mmap(0, MEMO_SIZE, PROT_READ, MAP_PRIVATE, backing_ptr_fd, 0); FILE *input_fp = fopen(input_file, "r"); FILE *output_fp=fopen(output_file, "w"); char buf[BUF_SIZE]; /* represent the number of the next unallocated physical page inside the main memory*/ unsigned char freePage = 0; while (fgets(buf, BUF_SIZE, input_fp) != NULL) { int logical_addr = atoi(buf); int offset = logical_addr & OFFSET_MASK; int logical = (logical_addr >> OFFSET_BITS) & PAGE_MASK; int physical = pagetable[logical]; total_addr++; /*page fault*/ if (physical == -1) { pageFault++; physical = freePage; freePage++; memcpy(main_Memo + physical * PAGE_SIZE, backing_ptr + logical * PAGE_SIZE, PAGE_SIZE); pagetable[logical] = physical; } /*The signed byte value stored at the translated physicall address*/ int physicall_addr = (physical << OFFSET_BITS) | offset; signed char value = main_Memo[physical * PAGE_SIZE + offset]; fprintf(output_fp,"Logical address: %d physicall address: %d Value: %d ", logical_addr, physicall_addr, value); } printf("Number of Translated Addresses = %d ", total_addr);