Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Point;
import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<Point> midPoints(List<Point> points) {
        List<Point> midPoints = new ArrayList<>();
        for (int i = 0; i < points.size() - 1; i++) {
            Point p = points.get(i);
            Point next = points.get(i + 1);
            midPoints.add(new Point((p.x + next.x) / 2, (p.y + next.y) / 2));
        }
        return midPoints;
    }
}