All pastes #895658 Raw Edit

Untitled

public text v1 · immutable
·published 2008-02-07 23:43 UTC
rendered paste body
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
/*
 * Alphabetizing.java
 * Copyright (C) Elias Sopkin 2008 <Omnimon-X@hotmail.com>
 * 
 * main.java is free software.
 * 
 * You may redistribute it and/or modify it under the terms of the
 * GNU General Public License, as published by the Free Software
 * Foundation; either version 2 of the License, or (at your option)
 * any later version.
 * 
 * main.java is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with main.java.  If not, write to:
 * 	The Free Software Foundation, Inc.,
 * 	51 Franklin Street, Fifth Floor
 * 	Boston, MA  02110-1301, USA.
 */
//import javax.swing.JOptionPane;

class Alphabetizing {
	public static void main (String[]args)
  {

    String[] names = new String[]
    {
    "Air The Movie",
	"Air",
	"Ajimu Beach Story",
	"Aishiteruze Baby",
	"Akane Maniax",
	"Amazing Nurse Nanako",
	"Android Announcer Maico 2010",
	"AniKuri 15",
	"Aquarion",
	"Arc The Lad",
	"AiKa",
	"Akira",
	"3x3 Eyes",
	"Ai Mai Mi Strawberry Egg",
	"Afro Samurai",
	"AD Police Files",
	"Aachi & Ssipak",
	"Ai Yori Aoshi Enishi",
	"Appleseed 2004",
	"Amaenaideyo",
	"Aria The Animation",
	"Aria The Natural",
	"Aria The OVA Arietta",
	"Asatte no Houkou",
	"Astro Boy 1963",
	"Astro Boy 1980",
	"Astro Boy 2003",
	"Black Lagoon",
	"Beyblade",
	"Bleach",
	"Bubblegum Crisis",
	"Bubblegum Crisis Tokyo 2040",
	"Card Captor Sakura",
	"Card Captor Sakura The Movie",
	"Card Captor Sakura Movie 2",
	"Chobits",
	"Chrno Crusade (Chrono Crusade)",
	"Claymore",
	"Cowboy Bebop",
	"Cowboy Bebop Movie",
	"Death Note",
	"Devil May Cry",
	"DGray Man",
	"Digimon Adventure",
	"Digimon Adventure 02",
	"Digimon Tamers",
	"Digimon Frontier",
	"Digimon Savers",
	"Digimon The Movie",
	"Digimon Revenge Of Diaboromon",
	"Digimon Battle Of Adventures",
	"Digimon Runaway Locomon",
	"Digimon Island Of Lost Digimon",
	"DN Angel",
	"Dot Hack Liminality",
	"Dot Hack Legend Of The Twilight",
	"Dot Hack Roots",
	"Dual Parallel Trouble Adventure",
	"Elfen Lied",
	"Erementar Gerad",
	"Fatal Fury Legend Of The Hungry",
	"Fatal Fury The Motion Picture",
	"Fatal Fury The New Battle",
	"Final Fantasy The Spirits Within",
	"Final Fantasy 7 Advent Children",
	"Final Fantasy VII Last Order",
	"Final Fantasy Unlimited",
	"FLCL",
	"Full Metal Panic",
	"Fullmetal Alchemist",
	"Gasaraki",
	"Gatchaman",
	"Geneshaft",
	"Get_Backers",
	"Ghost In The Shell",
	"Ghost In The Shell 2 Innocence",
	"Ghost in the Shell S.A.C 1st GIG",
	"Ghost in the Shell S.A.C 2nd GIG",
	"Mobile Suit Gundam",
	"Gundam ZZ",
	"Gundam 0083",
	"G Gundam",
	"Gundam Wing",
	"Gundam X",
	"Gundam Wing Endless Waltz",
	"Gundam Seed",
	"Gundam Seed Destiny",
	"Gungrave",
	"Hikaru no Go",
	"Hellsing",
	"Hellsing 2006",
	"Initial D",
	"Initial D Second Stage",
	"Initial D Third Stage",
	"Initial D - Fourth Stage",
	"Initial D Battle Stage",
	"Initial D Extra Stage",
	"InuYasha",
	"Inuyasha Movie 1",
	"Inuyasha Movie 2",
	"Inuyasha Movie 3",
	"Inuyasha Movie 4",
	"Jubei Chan The Ninja Girl",
	"Kaleido Star",
	"Kasimasi ~Girl Meets Girl~",
	"Lost Universe",
	"Love Hina",
	"Love Hina Again",
	"Maburaho",
	"Megas XLR",
	"Magic Knight Rayearth",
	"Magic Knight Rayearth OVA\\",
	"Magical Girl Lyrical Nanoha",
	"Melancholy of Haruhi Suzumiya",
	"Naruto Movie 1 (Dubbed)",
	"Naruto Movie 2",
	"Naruto Movie 3",
	"Naruto (Subbed)",
	"Naruto Shippuuden",
	"Neon Genesis Evangelion",
	"Now and Then Here and There",
	"Prince Of Tennis",
	"Robotech",
	"The Adventures of Mini Goddess",
	"The Dark Myth",
	"Transformers Armada",
	"Transformers Beast Machines",
	"Transformers Beast Wars",
	"Transformers Cybertron",
	"Transformers Energon",
	"Transformers Headmasters",
	"Transformers Masterforce",
	"Transformers Victory",
	"Bleach [Dub]",
	"Transformers",
	"Aoki Densetsu Shoot!",
	"Apocalypse Zero",
	"Ar Tonelico The Girl Who Sings",
	"Arcadia of My Youth",
	"Attacker You",
	"BALDR FORCE EXE Resolution",
	"BLAME!",
	"Baby Love",
	"Bagi The Monster Of Mighty Natur",
	"Bakumatsu Kikansetsu Irohanihohe",
	"Banner Of The Stars I",
	"Banner Of The Stars III",
	"Bare Foot Gen",
	"Bartender",
	"Dragon Ball GT Movie",
	"Dragon Ball Movie 01 (dubbed)",
	"Dragon Ball Movie 02 (dubbed)",
	"Dragon Ball Movie 04",
	"Dragon Ball Z Movie 01",
	"Dragon Ball Z Movie 02",
	"Dragon Ball Z Movie 03",
	"Dragon Ball Z Movie 04",
	"Dragon Ball Movie 01",
	"Dragon Ball Movie 02",
	"Dragon Ball Z Movie 5",
	"Dragon Ball Z Movie 6",
	"Dragon Ball Z Movie 7",
	"Dragon Ball Z Movie 8",
	"Dragon Ball Z Movie 9",
	"Dragon Ball Movie 03",
	"Dragon Ball Z Movie 10",
	"Dragon Ball Z Movie 11",
	"Dragon Ball Z Movie 12",
	"Dragon Ball Z Movie 13",
	"Dragon Ball Z Special 1",
	"Dragon Ball Z Special 2",
	"Dragon Ball Z Dubbed",
	"5 Centimetres Per Second",
	"Angel Tails 2",
	"Avenger",
	"Ayakashi Samurai Horror Tales",
	"Banner Of The Stars II",
	"Blue Seed",
	"Blue Seed Beyond II",
	"Blue Seed Omake",
	"Bobobo-bo bo-bobo",
	"Mezzo Danger Service Agency",
	"Monster Rancher",
	"Monster Rancher 2000",
	"Mouse",
	"Nightwalker",
	"Noir",
	"Air Gear",
	"Dragon Ball Z Remastered",
	"3x3 Eyes Legend of Divine Demon",
	"Galaxy Angel Season 1",
	"Please Teacher",
	"Please Twins",
	"Ragnarok The Animation",
	"Ranma Big trouble in Nekonron",
	"Ranma"};
    int[] numbers = new int[names.length];
    String[] newnames = new String[names.length];
    String temp = names[0];
    for(int y = 0;y<names.length;y++) {
        for (int x = 1;x < names.length;x++) {
        	for(int z = 0;z < names.length;z++) {
        		newnames[z] = names[z];
        	}
        	if(alpha(newnames[x],newnames[x-1]))
        		temp = newnames[x];
        	else
        		temp = newnames[x-1];
            newnames[x] = temp;
        }
        numbers[y] =+ 100 + y;
        System.out.println(numbers[y] + " " + newnames[y]);
    }
  }
	public static boolean alpha(String a,String b) {
		if (a.charAt(0) < b.charAt(0))
			return false;
		else if(a.charAt(0) == b.charAt(0)) {
			boolean ab = bet(a,b);
			if (ab) {
				return true;
			}
		}
		else
			return true;
		return false;
	}
	public static boolean bet(String a,String b) {
		if (a.length() > b.length()) {
			for(int x = 0;x < a.length();x++) {
				if(a.charAt(x) < b.charAt(x)) {
					return true;
				}
				else
					return false;
			}
		}
		else {
			for(int x = 0;x < b.length();x++) {
				if(a.charAt(x) < b.charAt(x)) {
					return true;
				}
				else
					return false;
			}
		}
		return false;
	}
}