Question
Must comment on the code at every /* Comment Here */ section about what the code is doing. /** * Address.java * * Usage: *
Must comment on the code at every "/* Comment Here */" section about what the code is doing.
/** * Address.java * * Usage: * java Address
public class Address { public static final int ADDRESS_SIZE = 32;
public static void main(String[] args) { if (args.length != 2) { System.err.println("Usage: java Address
int pageBits = 0;
int pageMask = 0; int offsetMask = 0;
/* Comment Here */ switch (pageSize) { case 1024: pageBits = 10; offsetMask = 0x000003ff; pageMask = 0xfffffc00; break; case 2048: pageBits = 11; offsetMask = 0x000007ff; pageMask = 0xfffff800; break; case 4096: pageBits = 12; offsetMask = 0x00000fff; pageMask = 0xfffff000; break; case 8192: pageBits = 13; offsetMask = 0x00001fff; pageMask = 0xffffe000; break; case 16384: pageBits = 14; offsetMask = 0x00003fff; pageMask = 0xffffcfff; break; }
int pageNumber = (address & pageMask) >> pageBits; int offset = (address & offsetMask);
/* Comment Here */ System.out.println("For address " + address + " page number = " + pageNumber + " offset = " + offset);
} }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started