package com.example.myapplication;

import android.os.Build;
import android.os.Bundle;
import android.support.annotation.RequiresApi;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import java.lang.reflect.Array;
import java.util.LinkedList;

public class MainActivity extends AppCompatActivity {

    @RequiresApi(api = Build.VERSION_CODES.P)
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        int[] array=new int[]{1,2,3,4,5,6,7,8};
        int i;
        i=array.length;
        i=(int)i/2;
        TextView textView = findViewById(R.id.text);
        textView.setText(String.valueOf(array[i]));

    }

}


