Example usage for java.lang Double toString

List of usage examples for java.lang Double toString

Introduction

In this page you can find the example usage for java.lang Double toString.

Prototype

public static String toString(double d) 

Source Link

Document

Returns a string representation of the double argument.

Usage

From source file:com.netcracker.ejb.MapBean.java

public String geodecodeAddress(double lng, double lat) throws JSONException, IOException {
    Map<String, String> params = Maps.newHashMap();
    params.put("language", "en");
    params.put("sensor", "false");
    params.put("latlng", Double.toString(lng) + "," + Double.toString(lat));
    String url = baseUrl + '?' + encodeParams(params);
    JSONObject response = read(url);/*from   w  w w  .  j  ava2 s .com*/
    JSONObject location = response.getJSONArray("results").getJSONObject(0);
    String formattedAddress = location.getString("formatted_address");
    return formattedAddress;
}

From source file:br.ime.usp.aztec.aztdis.AZTDISCommandLineParametersParser.java

@Override
protected AZTDISParameters buildParameters(CommandLine options) throws IllegalArgumentException {
    if (options.hasOption('t') && options.hasOption('e')) {
        double threshold = Double.parseDouble(options.getOptionValue('t'));
        double displacement = Double.parseDouble(options.getOptionValue('e'));
        double minimumDistance = Double
                .parseDouble(options.getOptionValue('k', Double.toString(AZTDISParameters.DEFAULT_K)));
        return new AZTDISParameters.Builder().withThreshold(threshold).withMaximumDisplacement(displacement)
                .withMinimumDistanceBetweenEvents(minimumDistance)
                .withInput(new SignalParser(this.openInputGivenIn(options)))
                .withOutput(new WriterEncodingOutput(this.openOutputGivenIn(options))).build();
    }/* w ww.j av  a2s.  c o  m*/
    throw new IllegalArgumentException("Mandatory argument not given." + " -t and -e are mandatory.");
}

From source file:attask.engine.ResponseInterpreter.java

public static HourBean handleHourUpdateResponse(ClientResponse response, HourBean incomingHr) {
    HourBean hour = new HourBean();
    JSONObject obj = new JSONObject(response.getEntity(String.class));
    try {/*w  w w .ja  v a 2  s .  c o m*/
        String hours = Double.toString(obj.getJSONObject("data").getDouble("hours"));
        incomingHr.convertData(hours);
        return incomingHr;
    } catch (Exception ex) {
        System.out.println(ex.getMessage());
        return null;
    }

}

From source file:com.opengamma.financial.analytics.volatility.cube.SyntheticSecuritySwaptionVolatilityCubeInstrumentProvider.java

@Override
public ExternalId getInstrument(final Tenor swapMaturity, final Tenor swaptionExpiry,
        final Double relativeStrike) {
    ArgumentChecker.notNull(swapMaturity, "swap maturity");
    ArgumentChecker.notNull(swaptionExpiry, "swaption expiry");
    ArgumentChecker.notNull(relativeStrike, "relative strike");
    final StringBuffer ticker = new StringBuffer(_prefix);
    final String swaptionString = getTenorString(swaptionExpiry);
    final String swapString = getTenorString(swapMaturity);
    ticker.append(swaptionString);//  w  w  w.j ava 2s.c  o m
    ticker.append(swapString);
    ticker.append(Double.toString(relativeStrike));
    return ExternalId.of(ExternalSchemes.OG_SYNTHETIC_TICKER, ticker.toString());
}

From source file:io.fabric8.example.stddev.http.StdDevProcessor.java

@Override
public void process(Exchange exchange) throws Exception {
    String message = exchange.getIn().getBody(String.class);
    ObjectMapper objectMapper = new ObjectMapper();
    TypeFactory typeFactory = objectMapper.getTypeFactory();
    List<Double> values = objectMapper.readValue(message,
            typeFactory.constructCollectionType(List.class, Double.class));
    SummaryStatistics summaryStatistics = new SummaryStatistics();
    List<Double> list = new ObjectMapper().readValue(message, List.class);
    for (Double value : list) {
        summaryStatistics.addValue(value);
    }/*  w w  w  . jav a  2s . c  o m*/
    String stdDev = Double.toString(summaryStatistics.getStandardDeviation());
    exchange.getOut().setBody(stdDev);
}

From source file:io.fabric8.example.variance.http.VarianceProcessor.java

@Override
public void process(Exchange exchange) throws Exception {
    String message = exchange.getIn().getBody(String.class);
    ObjectMapper objectMapper = new ObjectMapper();
    TypeFactory typeFactory = objectMapper.getTypeFactory();
    List<Double> values = objectMapper.readValue(message,
            typeFactory.constructCollectionType(List.class, Double.class));
    SummaryStatistics summaryStatistics = new SummaryStatistics();
    List<Double> list = new ObjectMapper().readValue(message, List.class);
    for (Double value : list) {
        summaryStatistics.addValue(value);
    }//from w w  w  .  j a va2  s.  c  o m
    String variance = Double.toString(summaryStatistics.getVariance());
    exchange.getOut().setBody(variance);
}

From source file:io.codis.nedis.util.NedisUtils.java

public static byte[] toBytesExclusive(double value) {
    return toBytes("(" + Double.toString(value));
}

From source file:fr.matthiasbosc.translucentmap.PlaceDetailsJSONParser.java

/** Receives a JSONObject and returns a list */
public List<HashMap<String, String>> parse(JSONObject jObject) {

    Double lat = Double.valueOf(0);
    Double lng = Double.valueOf(0);
    String formattedAddress = "";

    HashMap<String, String> hm = new HashMap<String, String>();
    List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();

    try {/*from w w w  . ja  v a2s  .c om*/
        lat = (Double) jObject.getJSONObject("result").getJSONObject("geometry").getJSONObject("location")
                .get("lat");
        lng = (Double) jObject.getJSONObject("result").getJSONObject("geometry").getJSONObject("location")
                .get("lng");
        formattedAddress = (String) jObject.getJSONObject("result").get("formatted_address");

    } catch (JSONException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }

    hm.put("lat", Double.toString(lat));
    hm.put("lng", Double.toString(lng));
    hm.put("formatted_address", formattedAddress);

    list.add(hm);

    return list;
}

From source file:com.espe.distribuidas.protocolocajero.operaciones.RetiroRQ.java

@Override
public String asTexto() {
    StringBuilder sb = new StringBuilder();
    sb.append(this.cuenta);
    sb.append("_").append(this.tipo).append("_");
    sb.append(StringUtils.leftPad(Double.toString(this.valorRetiro), 10, "0"));
    sb.append("_").append(this.documetoDepositante).append("_");
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy/HH/mm/ss");
    sb.append(sdf.format(this.fecha));
    return sb.toString();
}

From source file:com.espe.distribuidas.protocolocajero.operaciones.DepositoRQ.java

@Override
public String asTexto() {
    StringBuilder sb = new StringBuilder();
    sb.append(this.cuenta);
    sb.append("_").append(this.tipo).append("_");
    sb.append(StringUtils.leftPad(Double.toString(this.valorDeposito), 10, "0"));
    sb.append("_").append(this.documetoDepositante).append("_");
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy/HH/mm/ss");
    sb.append(sdf.format(this.fecha));

    return sb.toString();
}