@ Pure @ SuppressWarnings ( "checkstyle:returncount" ) public static double toMeters ( double value , SpaceUnit inputUnit ) { switch ( inputUnit ) { case TERAMETER : return value * 1e12 ; case GIGAMETER : return value * 1e9 ; case MEGAMETER : return value * 1e6 ; case KILOMETER : return value * 1e3 ; case HECTOMETER : return value * 1e2 ; case DECAMETER : return value * 1e1 ; case METER : break ; case DECIMETER : return value * 1e-1 ; case CENTIMETER : return value * 1e-2 ; case MILLIMETER : return value * 1e-3 ; case MICROMETER : return value * 1e-6 ; case NANOMETER : return value * 1e-9 ; case PICOMETER : return value * 1e-12 ; case FEMTOMETER : return value * 1e-15 ; default : throw new IllegalArgumentException ( ) ; } return value ; }
Convert the given value expressed in the given unit to meters .