You may want to take a look at the
WPILib Java documentation on Ultrasonic sensors. I personally haven't used them, but it looks like (based off of the Javadocs) that you code should look similiar to this:
Code:
//Setting up the sensor
Ultrasonic ultra = new Ultrasonic(0, 1); //Make a new Ultrasonic Sensor on "pingChannel" 0 and "echoChannel" 1.
ultra.setAutomaticMode(true); //If you don't want to have to call ultra.ping() whenever you want to check for values
ultra.setEnabled(true); //Enable the Ultrasonic sensor
//Whenever you want to read values:
double millis = ultra.getRangeMM(); //Get distance in millimeters
double inches = ultra.getRangeInches(); //Get distance in inches