SHARE
TWEET

Untitled

a guest Aug 25th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.Arrays;
  4.  
  5. public class Main {
  6.  
  7.     public static void main(String[] args) {
  8.         int[] m = { 9, 6, 3, 11, 31, 5 };
  9.         System.out.println("Исходный массив: " + Arrays.toString(m));
  10.  
  11.         int tmp = 0;
  12.         for (int i = 0; i < m.length/2; i++) {
  13.  
  14.             tmp = m[m.length-i-1];
  15.             m[m.length-i-1] = m[i];
  16.             m[i] = tmp;
  17.         }
  18.         System.out.println("Финальный массив: " + Arrays.toString(m));
  19.     }
  20.  
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top