-1

I have added values on TimeSeries and i would like to compare them,which was before and which was after.The type of values Millisecond. I tryed different ways, but no one of them works....is it possible? My milliseconds comes to TimeSeries from this :

long t = System.currentTimeMillis();

long endTime   = System.currentTimeMillis();

long totalTime = endTime - t;

Date time = new Date(totalTime);

final Millisecond now = new Millisecond(time);

 chartAzot.filler(now, doubleValue); //selfmade method to adds values to TimeSeries and some more logic

I have ArrayList of values,which was putted on my TimeSeries.Also i have clicked point on chart,which get's x value as double/millisecond/Number .

current=(Millisecond) localSeriesTime.get(3);
Number x1 = myPointonSeries.getX(0);

I tryed to change values types to Date,but got error NumberFormatExeption. I was trying to convert values to String and String to Integer.ParseInt(myStringFromMillisecond

Sashok
  • 1
  • 2
  • Hey! Please provide the relevant code for the question in your question. Including your tries. – akuzminykh May 28 '20 at 06:18
  • What is class Millisecond? We need code and examples of what you want to do. – Joakim Danielson May 28 '20 at 06:24
  • Yes i put some edits to add context,I'm sorry – Sashok May 28 '20 at 06:35
  • Well, when you have the start and end times as `long`s, the comparisons are nothing but simple comparisons of `long`s. I'm having a hard time understanding what exactly you are struggeling with. Btw. is `Millisecond` a custom class of yours? – akuzminykh May 28 '20 at 06:45
  • In total i havent long value,but if add to my long Totaltime to ArrayList instead of Millisecond now , it may helps,will thik about it – Sashok May 28 '20 at 06:54

1 Answers1

0

I am pretty sure, you mean this class: Millisecond

As you can see, the superclass RegularTimePeriod implements Comparable. Therefore you can compare Milliseconds by using Comparable#compareTo.

Community
  • 1
  • 1
ThexXTURBOXx
  • 381
  • 1
  • 3
  • 16