# linear equation with conditions in Java

I have the following problem: I want to determine a linear equation for a data table with $$x$$ and $$y$$ value. Point 1 should be the point where the first time $$y > 0$$ and point 2 should be the point where the last time $$y < 1$$. The linear equation is then to be generated between points 1 and 2. For example in the table between point $$x = 2$$ and $$x = 4$$. In addition the x-values are written in an array, the y-values are imported from an excel-file. At the end I want so save the parameters of the linear equation.

x y
1 0.0
2 0.1
3 0.4
4 0.95
5 1.1
6 0.9
• So you want a line connecting the points (2,0.1) and (4,0.95), and the rest of the points are ignored? if that is not the case, you need to explain more clearly. Mar 14 at 15:36
• @Handballer73, are you trying to do something like this? Mar 15 at 12:15
• Yes, the other points can be ignored... Mar 15 at 14:53