How to wire a V7-2B17D8-048?

We are have a hard time trying to wire up a limit switch and have no idea how to program it in JAVA.

Wiring is pretty simple, use a standard PWM cable and wire the negative and signal wires to the switch, using the common and NO or NC contact depending on how you want your switch to act (switch when opened, or switch when closed). The DSC has pull-up resistors therefor the positive PWM wire is not needed.

This should help you as well,
http://wpilib.screenstepslive.com/s/3120/m/7912/l/170868-using-limit-switches-to-control-behavior