my code

3)a) Implementar la función “estaOrdenado” que dado un arreglo de tamaño n y una posición i, es verdadera si el elemento de la posición i esta ordenado,  es decir,  es mayor que todos los elementos que están en las posiciones [0,1, ...  ,i-1]
b)  Implementar la función “ordenado” que es verdadera sii para todo i < n
estaOrdenado(int[] arreglo, i)esverdadera
booleanordenado(int[] arreglo){// n = arreglo.length()}

Snippet options

Download: Download snippet as
Copy snippet: For this you need a free my code account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

public class Ej3 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Integer lista1[]= {1,2,3,4,5,6};
		Integer lista2[]= {21,5,4,3,20,1};

			} catch(java.lang.ArrayIndexOutOfBoundsException cecilialee) {
				System.out.println("El número es muy grande!");

static boolean estaOrdenado(Integer[] lista,int pos ){
	boolean ret = true;
	for(int i = 0; i<pos; i++)
		ret = ret && (lista[pos]>lista[i]);
	return ret;

static boolean ordenado(Integer[]lista){
  boolean ret = true;
  for(int i=0;i<lista.length;i++){
  ret = ret && (estaOrdenado(lista, i));
  return ret;


Create a free my code account now.

my code is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.