Reading Excel Sheet Documents in Java


For some reason i found Apache POI difficult to use for reading excel sheet, in terms of naming conventions and the code so i was searching for another Library for reading Excel Sheet in Java and i stopped at JXL.
Java Excel API namely JXL is an Java based API that allows us to read/write/edit the Excel Sheet. The main think i liked about it was its simplicity over Apache POI Package. This article will show you how we can read Excel Sheet using JXL.

Now here i am going to read an excel sheet having content:

EmpId Name Designation

1

ABC

Software Engineer

2

DFG

Sr Software Engineer

3

LOI

Team Leader

4 LKJ Project Manager
5 QWE Software Architech

I have uploaded the same excel sheet on the server you can download it from here: Download Excel Sheet

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Locale;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.WorkbookSettings;
import jxl.read.biff.BiffException;
import jxl.DateCell;
public class ReadXLSheet {
    public void init(String filePath) {
        FileInputStream fs = null;
        try {
            fs = new FileInputStream(new File(filePath));
            contentReading(fs);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }finally {
            try {
                fs.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    //Returns the Headings used inside the excel sheet
    public void getHeadingFromXlsFile(Sheet sheet) {
        int columnCount = sheet.getColumns();
        for (int i = 0; i < columnCount; i++) {
            System.out.println(sheet.getCell(i, 0).getContents());
        }
    }
    public void contentReading(InputStream fileInputStream) {
        WorkbookSettings ws = null;
        Workbook workbook = null;
        Sheet s = null;
        Cell rowData[] = null;
        int rowCount = ‘0’;
        int columnCount = ‘0’;
        DateCell dc = null;
        int totalSheet = 0;
        try {
            ws = new WorkbookSettings();
            ws.setLocale(new Locale("en", "EN"));
            workbook = Workbook.getWorkbook(fileInputStream, ws);
            totalSheet = workbook.getNumberOfSheets();
            if(totalSheet > 0) {
                System.out.println("Total Sheet Found:" + totalSheet);
                for(int j=0;j<totalsheet ;j++) {
                    System.out.println("Sheet Name:" + workbook.getSheet(j).getName());
                }
            }
            //Getting Default Sheet i.e. 0
            s = workbook.getSheet(0);
            //Reading Individual Cell
            getHeadingFromXlsFile(s);
            //Total Total No Of Rows in Sheet, will return you no of rows that are occupied with some data
            System.out.println("Total Rows inside Sheet:" + s.getRows());
            rowCount = s.getRows();
            //Total Total No Of Columns in Sheet
            System.out.println("Total Column inside Sheet:" + s.getColumns());
            columnCount = s.getColumns();
            //Reading Individual Row Content
            for (int i = 0; i < rowCount; i++) {
                //Get Individual Row
                rowData = s.getRow(i);
                if (rowData[0].getContents().length() != 0) { // the first date column must not null
                    for (int j = 0; j < columnCount; j++) {
                        switch (j) {
                        case 0:
                            System.out.println("Employee Id:" + rowData[j].getContents());
                        case 1:
                            System.out.println("Employee Name:" + rowData[j].getContents());
                        case 2:
                            System.out.println("Employee Designation:" + rowData[j].getContents());
                        default:
                            break;
                        }
                    }
                }
            }
            workbook.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (BiffException e) {
            e.printStackTrace();
        }
    }
        public static void main(String[] args) {
        try {
            ReadXLSheet xlReader = new ReadXLSheet();
            xlReader.init("/home/hitesh/Desktop/test.xls");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

 

Total Sheet Found:3
----------------------------------------------
Sheet Name:Sheet1
Sheet Name:Sheet2
Sheet Name:Sheet3
----------------------------------------------
Column Heading:EmpId
Column Heading:Name
Column Heading:Designation
----------------------------------------------
Total Rows inside Sheet:6
----------------------------------------------
Total Column inside Sheet:3
----------------------------------------------
Employee Id:EmpId
Employee Name:Name
Employee Designation:Designation
----------------------------------------------
Employee Id:1
Employee Name:ABC
Employee Designation:Software Engineer
----------------------------------------------
Employee Id:2
Employee Name:DFG
Employee Designation:Sr Software Engineer
----------------------------------------------
Employee Id:3
Employee Name:LOI
Employee Designation:Team Leader
----------------------------------------------
Employee Id:4
Employee Name:LKJ
Employee Designation:Project Manager
----------------------------------------------
Employee Id:5
Employee Name:QWE
Employee Designation:Software Architect

 

With respect to the following code written i am able to perform the following operation:

  • Calculate total no of Sheets inside the Excel Sheet
  • List all the Sheet Name used inside Excel Sheet
  • Read Individual Cell for specifying the cell position – in code have read the column heading i.e. 1st row
  • Read Total Modified Rows in the Excel Sheet
  • Read Total Modified Columns in the Excel Sheet
  • Read Individual Row Content

 

Source : Techie Zone Blog

Convert romaji to hiragana or katakana using java


This is a class :

/**
* @author Hungtp
*
*/
public class JapaneseHelper {

private String romaji;
private String hiragana;
private String katakana;
private char currChar;
private boolean checkIsHinagana()
{
if(romaji.length()!=0)
{
if(romaji.charAt(0)>255)
return true;
}
return false;
}
public String Convert(String strConvert,boolean isHiragana) {
romaji=strConvert;
if(checkIsHinagana())
return romaji;
performConversion();
if(isHiragana)
return hiragana;
else
return katakana;
}
private void start() {
currChar = romaji.charAt(0);
}

private void advance() {
if (romaji.length() != 0) {
romaji = romaji.substring(1, romaji.length());
if (romaji.length() == 0) {
currChar = 0;
return;
}
currChar = romaji.charAt(0);
}
}

private void longACheck() {
if (currChar == ‘a’) {
hiragana += “\u3042”;
katakana += “\u30FC”;
advance();
}
}

private void longECheck() {
if (currChar == ‘e’) {
hiragana += “\u3048”;
katakana += “\u30FC”;
advance();
}
}

private void longICheck() {
if (currChar == ‘i’) {
hiragana += “\u3044”;
katakana += “\u30FC”;
advance();
}
}

private void longOCheck() {
if (currChar == ‘o’) {
hiragana += “\u304A”;
katakana += “\u30FC”;
advance();
}
}

private void longUCheck() {
if (currChar == ‘u’) {
hiragana += “\u3046”;
katakana += “\u30FC”;
advance();
}
}

private void forcedY() {
if (currChar == ‘a’) {
hiragana += “\u3083”;
katakana += “\u30E3”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u3047”;
katakana += “\u30A7”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3043”;
katakana += “\u30A3”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u3087”;
katakana += “\u30E7”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u3085”;
katakana += “\u30E5”;
advance();
longUCheck();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3083\u3042”;
katakana += “\u30E3\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3047\u3048”;
katakana += “\u30A7\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3043\u3044”;
katakana += “\u30A3\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3087\u3046”;
katakana += “\u30E7\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3085\u3046”;
katakana += “\u30E5\u30FC”;
advance();
}
}

// Expect a small “ya”, “yu”, or “yo” kana, but leave it alone for an i
// such as for “chi”, “ji”, etc.
private void partialForcedY() {
if (currChar == ‘i’) {
advance();
longICheck();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3044”;
katakana += “\u30FC”;
advance();
} else {
forcedY();
}
}

// adds small vowel or semivowel kana after a kana that has been dealt with
// such as for fa, ve, t’i etc.
private void forcedVowel() {
if (currChar == ‘a’) {
hiragana += “\u3041”;
katakana += “\u30A1”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u3047”;
katakana += “\u30A7”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3043”;
katakana += “\u30A3”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u3049”;
katakana += “\u30A9”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u3045”;
katakana += “\u30A5”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3041\u3042”;
katakana += “\u30A1\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3047\u3048”;
katakana += “\u30A7\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3043\u3044”;
katakana += “\u30A3\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3049\u3046”;
katakana += “\u30A9\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3045\u3046”;
katakana += “\u30A5\u30FC”;
advance();
}
}

private void romajiA() {
advance();
hiragana += “\u3042”;
katakana += “\u30A2”;
longACheck();
}

private void romajiB() {
advance();
if (currChar == ‘a’) {
hiragana += “\u3070”;
katakana += “\u30D0”;
advance();
longACheck();
} else if (currChar == ‘b’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiB();
} else if (currChar == ‘e’) {
hiragana += “\u3079”;
katakana += “\u30D9”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3073”;
katakana += “\u30D3”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u307C”;
katakana += “\u30DC”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u3076”;
katakana += “\u30D6”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u3073”;
katakana += “\u30D3”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3070\u3042”;
katakana += “\u30D0\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3079\u3048”;
katakana += “\u30D9\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3073\u3044”;
katakana += “\u30D3\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u307C\u3046”;
katakana += “\u30DC\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3076\u3046”;
katakana += “\u30D6\u30FC”;
advance();
} else {
hiragana += “\u3076”;
katakana += “\u30D6”;
}
}

private void romajiC() {
advance();
if (currChar == ‘c’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiC();
} else if (currChar == ‘h’) {
hiragana += “\u3061”;
katakana += “\u30C1”;
advance();
partialForcedY();
} else if (currChar == ‘k’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiK();
} else {
hiragana += “\u304F”;
katakana += “\u30AF”;
}
}

private void romajiD() {
advance();
if (currChar == ‘\”) {
advance();
romajiDapos();
} else if (currChar == ‘a’) {
hiragana += “\u3060”;
katakana += “\u30C0”;
advance();
longACheck();
} else if (currChar == ‘d’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiD();
} else if (currChar == ‘e’) {
hiragana += “\u3067”;
katakana += “\u30C7”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3067\u3043”;
katakana += “\u30C7\u30A3”;
advance();
longICheck();
} else if (currChar == ‘j’) {
hiragana += “\u3062”;
katakana += “\u30C2”;
advance();
partialForcedY();
} else if (currChar == ‘o’) {
hiragana += “\u3069”;
katakana += “\u30C9”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u3069\u3045”;
katakana += “\u30C9\u30A5”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u3067”;
katakana += “\u30C7”;
advance();
forcedY();
} else if (currChar == ‘z’) {
advance();
romajiDZ();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3060\u3042”;
katakana += “\u30C0\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3067\u3048”;
katakana += “\u30C7\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3067\u3043\u3044”;
katakana += “\u30C7\u30A3\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3069\u3046”;
katakana += “\u30C9\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3069\u3045\u3046”;
katakana += “\u30C9\u30A5\u30FC”;
advance();
} else {
hiragana += “\u3069”;
katakana += “\u30C9”;
}
}

private void romajiDapos() {
if (currChar == ‘u’) {
hiragana += “\u3069\u3045”;
katakana += “\u30C9\u30A5”;
advance();
longUCheck();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3069\u3045\u3046”;
katakana += “\u30C9\u30A5\u30FC”;
advance();
} else {
hiragana += “\u3067”;
katakana += “\u30C7”;
forcedVowel();
}
}

private void romajiDZ() {
if (currChar == ‘i’) {
hiragana += “\u3062”;
katakana += “\u30C2”;
advance();
longICheck();
} else if (currChar == ‘u’) {
hiragana += “\u3065”;
katakana += “\u30C5”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u3062”;
katakana += “\u30C2”;
advance();
forcedY();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3062\u3044”;
katakana += “\u30C2\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3065\u3046”;
katakana += “\u30C5\u30FC”;
advance();
} else {
hiragana += “\u3062”;
katakana += “\u30C2”;
forcedY();
}
}

private void romajiE() {
advance();
hiragana += “\u3048”;
katakana += “\u30A8”;
longECheck();
}

private void romajiF() {
advance();
if (currChar == ‘f’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiF();
} else if (currChar == ‘u’) {
hiragana += “\u3075”;
katakana += “\u30D5”;
advance();
longUCheck();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3075\u3046”;
katakana += “\u30D5\u30FC”;
advance();
} else {
hiragana += “\u3075”;
katakana += “\u30D5”;
forcedVowel();
}
}

private void romajiG() {
advance();
if (currChar == ‘a’) {
hiragana += “\u304C”;
katakana += “\u30AC”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u3052”;
katakana += “\u30B2”;
advance();
longECheck();
} else if (currChar == ‘g’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiG();
} else if (currChar == ‘i’) {
hiragana += “\u304E”;
katakana += “\u30AE”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u3054”;
katakana += “\u30B4”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u3050”;
katakana += “\u30B0”;
advance();
longUCheck();
} else if (currChar == ‘w’) {
hiragana += “\u3050”;
katakana += “\u30B0”;
advance();
forcedVowel();
} else if (currChar == ‘y’) {
hiragana += “\u304E”;
katakana += “\u30AE”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u304C\u3042”;
katakana += “\u30AC\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3052\u3048”;
katakana += “\u30B2\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u304E\u3044”;
katakana += “\u30AE\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3054\u3046”;
katakana += “\u30B4\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3050\u3046”;
katakana += “\u30B0\u30FC”;
advance();
} else {
hiragana += “\u3050”;
katakana += “\u30B0”;
}
}

private void romajiH() {
advance();
if (currChar == ‘a’) {
hiragana += “\u306F”;
katakana += “\u30CF”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u3078”;
katakana += “\u30D8”;
advance();
longECheck();
} else if (currChar == ‘h’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiH();
} else if (currChar == ‘i’) {
hiragana += “\u3072”;
katakana += “\u30D2”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u307B”;
katakana += “\u30DB”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u3075”;
katakana += “\u30D5”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u3072”;
katakana += “\u30D2”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u306F\u3042”;
katakana += “\u30CF\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3078\u3048”;
katakana += “\u30D8\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3072\u3044”;
katakana += “\u30D2\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u307B\u3046”;
katakana += “\u30DB\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3075\u3046”;
katakana += “\u30D5\u30FC”;
advance();
} else {
hiragana += “\u3075”;
katakana += “\u30D5”;
}
}

private void romajiI() {
advance();
hiragana += “\u3044”;
katakana += “\u30A4”;
longICheck();
}

private void romajiJ() {
advance();
if (currChar == ‘j’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiJ();
} else {
hiragana += “\u3058”;
katakana += “\u30B8”;
partialForcedY();
}
}

private void romajiK() {
advance();
if (currChar == ‘a’) {
hiragana += “\u304B”;
katakana += “\u30AB”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u3051”;
katakana += “\u30B1”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u304D”;
katakana += “\u30AD”;
advance();
longICheck();
} else if (currChar == ‘k’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiK();
} else if (currChar == ‘o’) {
hiragana += “\u3053”;
katakana += “\u30B3”;
advance();
longOCheck();
} else if (currChar == ‘q’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiQ();
} else if (currChar == ‘u’) {
hiragana += “\u304F”;
katakana += “\u30AF”;
advance();
longUCheck();
} else if (currChar == ‘w’) {
hiragana += “\u304F”;
katakana += “\u30AF”;
advance();
forcedVowel();
} else if (currChar == ‘y’) {
hiragana += “\u304D”;
katakana += “\u30AD”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u304D\u3042”;
katakana += “\u30AD\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3051\u3048”;
katakana += “\u30B1\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u304D\u3044”;
katakana += “\u30AD\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3053\u3046”;
katakana += “\u30B3\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u304F\u3046”;
katakana += “\u30AF\u30FC”;
advance();
} else {
hiragana += “\u304F”;
katakana += “\u30AF”;
}
}

private void romajiL() {
advance();
if (currChar == ‘a’) {
hiragana += “\u3089”;
katakana += “\u30E9”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u308C”;
katakana += “\u30EC”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u308A”;
katakana += “\u30EA”;
advance();
longICheck();
} else if (currChar == ‘l’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiL();
} else if (currChar == ‘o’) {
hiragana += “\u308D”;
katakana += “\u30ED”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u308B”;
katakana += “\u30EB”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u308A”;
katakana += “\u30EA”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3089\u3042”;
katakana += “\u30E9\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u308C\u3048”;
katakana += “\u30EC\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u308A\u3044”;
katakana += “\u30EA\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u308D\u3046”;
katakana += “\u30ED\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u308B\u3046”;
katakana += “\u30EB\u30FC”;
advance();
} else {
hiragana += “\u308B”;
katakana += “\u30EB”;
}
}

private void romajiM() {
advance();
if (currChar == ‘a’) {
hiragana += “\u307E”;
katakana += “\u30DE”;
advance();
longACheck();
} else if (currChar == ‘b’) {
hiragana += “\u3093”;
katakana += “\u30F3”;
romajiB();
} else if (currChar == ‘e’) {
hiragana += “\u3081”;
katakana += “\u30E1”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u307F”;
katakana += “\u30DF”;
advance();
longICheck();
} else if (currChar == ‘m’) {
hiragana += “\u3093”;
katakana += “\u30F3”;
romajiM();
} else if (currChar == ‘o’) {
hiragana += “\u3082”;
katakana += “\u30E2”;
advance();
longOCheck();
} else if (currChar == ‘p’) {
hiragana += “\u3093”;
katakana += “\u30F3”;
romajiP();
} else if (currChar == ‘u’) {
hiragana += “\u3080”;
katakana += “\u30E0”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u307F”;
katakana += “\u30DF”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u307E\u3042”;
katakana += “\u30DE\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3081\u3048”;
katakana += “\u30E1\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u307F\u3044”;
katakana += “\u30DF\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3082\u3046”;
katakana += “\u30E2\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3080\u3046”;
katakana += “\u30E0\u30FC”;
advance();
} else {
hiragana += “\u307F”;
katakana += “\u30DF”;
}
}

private void romajiN() {
advance();
if (currChar == ‘\”) {
hiragana += “\u3093”;
katakana += “\u30F3”;
advance();
} else if (currChar == ‘a’) {
hiragana += “\u306A”;
katakana += “\u30CA”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u306D”;
katakana += “\u30CD”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u306B”;
katakana += “\u30CB”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u306E”;
katakana += “\u30CE”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u306C”;
katakana += “\u30CC”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u306B”;
katakana += “\u30CB”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u306A\u3042”;
katakana += “\u30CA\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u306D\u3048”;
katakana += “\u30CD\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u306B\u3044”;
katakana += “\u30CB\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u306E\u3046”;
katakana += “\u30CE\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u306C\u3046”;
katakana += “\u30CC\u30FC”;
advance();
} else {
hiragana += “\u3093”;
katakana += “\u30F3”;
}
}

private void romajiO() {
advance();
hiragana += “\u304A”;
katakana += “\u30AA”;
longOCheck();
}

private void romajiP() {
advance();
if (currChar == ‘a’) {
hiragana += “\u3071”;
katakana += “\u30D1”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u307A”;
katakana += “\u30DA”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3074”;
katakana += “\u30D4”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u307D”;
katakana += “\u30DD”;
advance();
longOCheck();
} else if (currChar == ‘p’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiP();
} else if (currChar == ‘u’) {
hiragana += “\u3077”;
katakana += “\u30D7”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u3074”;
katakana += “\u30D4”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3071\u3042”;
katakana += “\u30D1\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u307A\u3048”;
katakana += “\u30DA\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3074\u3044”;
katakana += “\u30D4\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u307D\u3046”;
katakana += “\u30DD\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3077\u3046”;
katakana += “\u30D7\u30FC”;
advance();
} else {
hiragana += “\u3077”;
katakana += “\u30D7”;
}
}

private void romajiQ() {
advance();
if (currChar == ‘q’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiQ();
} else if (currChar == ‘u’) {
hiragana += “\u304F”;
katakana += “\u30AF”;
advance();
forcedVowel();
} else {
hiragana += “\u304F”;
katakana += “\u30AF”;
}
}

private void romajiR() {
advance();
if (currChar == ‘a’) {
hiragana += “\u3089”;
katakana += “\u30E9”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u308C”;
katakana += “\u30EC”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u308A”;
katakana += “\u30EA”;
advance();
longICheck();
} else if (currChar == ‘l’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiL();
} else if (currChar == ‘o’) {
hiragana += “\u308D”;
katakana += “\u30ED”;
advance();
longOCheck();
} else if (currChar == ‘r’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiR();
} else if (currChar == ‘u’) {
hiragana += “\u308B”;
katakana += “\u30EB”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u308A”;
katakana += “\u30EA”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3089\u3042”;
katakana += “\u30E9\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u308C\u3048”;
katakana += “\u30EC\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u308A\u3044”;
katakana += “\u30EA\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u308D\u3046”;
katakana += “\u30ED\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u308B\u3046”;
katakana += “\u30EB\u30FC”;
advance();
} else {
hiragana += “\u308B”;
katakana += “\u30EB”;
}
}

private void romajiS() {
advance();
if (currChar == ‘\”) {
hiragana += “\u3059”;
katakana += “\u30B9”;
advance();
forcedVowel();
} else if (currChar == ‘a’) {
hiragana += “\u3055”;
katakana += “\u30B5”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u305B”;
katakana += “\u30BB”;
advance();
longECheck();
} else if (currChar == ‘h’) {
hiragana += “\u3057”;
katakana += “\u30B7”;
advance();
partialForcedY();
} else if (currChar == ‘i’) {
hiragana += “\u3057”;
katakana += “\u30B7”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u305D”;
katakana += “\u30BD”;
advance();
longOCheck();
} else if (currChar == ‘s’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiS();
} else if (currChar == ‘u’) {
hiragana += “\u3059”;
katakana += “\u30B9”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u3057”;
katakana += “\u30B7”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3055\u3042”;
katakana += “\u30B5\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u305B\u3048”;
katakana += “\u30BB\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3057\u3044”;
katakana += “\u30B7\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u305D\u3046”;
katakana += “\u30BD\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3059\u3046”;
katakana += “\u30B9\u30FC”;
advance();
} else {
hiragana += “\u3059”;
katakana += “\u30B9″;
}
}

private void romajiT() {
advance();
if (currChar == ‘\”) {
advance();
romajiTapos();
} else if (currChar == ‘a’) {
hiragana += “\u305F”;
katakana += “\u30BF”;
advance();
longACheck();
} else if (currChar == ‘c’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiC();
} else if (currChar == ‘e’) {
hiragana += “\u3066”;
katakana += “\u30C6”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3061”;
katakana += “\u30C1”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u3068”;
katakana += “\u30C8”;
advance();
longOCheck();
} else if (currChar == ‘s’) {
hiragana += “\u3064”;
katakana += “\u30C4”;
advance();
romajiTS();
} else if (currChar == ‘t’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiT();
} else if (currChar == ‘u’) {
hiragana += “\u3064”;
katakana += “\u30C4”;
advance();
longUCheck();
} else if (currChar == ‘w’) {
hiragana += “\u3064”;
katakana += “\u30C4”;
advance();
forcedVowel();
} else if (currChar == ‘y’) {
hiragana += “\u3061”;
katakana += “\u30C1”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u305F\u3042”;
katakana += “\u30BF\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3066\u3048”;
katakana += “\u30C6\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3061\u3043\u3044”;
katakana += “\u30C1\u30A3\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3068\u3046”;
katakana += “\u30C8\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3064\u3046”;
katakana += “\u30C4\u30FC”;
advance();
} else {
hiragana += “\u3068”;
katakana += “\u30C8”;
}
}

private void romajiTapos() {
if (currChar == ‘u’) {
hiragana += “\u3068\u3045”;
katakana += “\u30C8\u30A5”;
advance();
longUCheck();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3068\u3045\u3046”;
katakana += “\u30C8\u30A5\u30FC”;
advance();
} else {
hiragana += “\u3066”;
katakana += “\u30C6”;
forcedVowel();
}
}

private void romajiTS() {
if (currChar == ‘u’) {
advance();
longUCheck();
} else if (currChar == ‘y’) {
advance();
forcedY();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3046”;
katakana += “\u30FC”;
advance();
} else {
forcedVowel();
}
}

private void romajiU() {
advance();
hiragana += “\u3046”;
katakana += “\u30A6″;
longUCheck();
}

private void romajiV() {
advance();
if (currChar == ‘\”) {
hiragana += “\u3094”;
katakana += “\u30F4”;
advance();
forcedVowel();
} else if (currChar == ‘u’) {
hiragana += “\u3094”;
katakana += “\u30F4”;
longUCheck();
} else if (currChar == ‘v’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiV();
} else if (currChar == ‘y’) {
hiragana += “\u3094”;
katakana += “\u30F4”;
advance();
forcedY();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3094\u3046”;
katakana += “\u30F4\u30FC”;
advance();
} else {
hiragana += “\u3094”;
katakana += “\u30F4″;
forcedVowel();
}
}

private void romajiW() {
advance();
if (currChar == ‘\”) {
hiragana += “\u3046”;
katakana += “\u30A6”;
advance();
forcedVowel();
} else if (currChar == ‘a’) {
hiragana += “\u308F”;
katakana += “\u30EF”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u3091”;
katakana += “\u30F1”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3090”;
katakana += “\u30F0”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u3092”;
katakana += “\u30F2”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u3046\u3045”;
katakana += “\u30A6\u30A5”;
advance();
longUCheck();
} else if (currChar == ‘w’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiW();
} else if (currChar == ‘y’) {
hiragana += “\u3046”;
katakana += “\u30A6”;
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u308F\u3042”;
katakana += “\u30EF\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3091\u3048”;
katakana += “\u30F1\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3090\u3043\u3044”;
katakana += “\u30F0\u30A3\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3092\u3046”;
katakana += “\u30F2\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3046\u3045\u3046”;
katakana += “\u30A6\u30A5\u30FC”;
advance();
} else {
hiragana += “\u3046”;
katakana += “\u30A6″;
}
}

private void romajiX() {
advance();
if (currChar == ‘\”) {
hiragana += “\u304D”;
katakana += “\u30AD”;
// let “x'” act like “kis”
romajiS();
} else if (currChar == ‘a’) {
hiragana += “\u3041”;
katakana += “\u30A1”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u3047”;
katakana += “\u30A7”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3043”;
katakana += “\u30A3”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u3049”;
katakana += “\u30A9”;
advance();
longOCheck();
} else if (currChar == ‘t’) {
// do some special-case lookaheads instead of using separate
// functions here
if (romaji.charAt(1) == ‘u’) {
advance();
advance();
hiragana += “\u3063”;
katakana += “\u30C3”;
}

else if (romaji.charAt(1) == ‘s’ && romaji.charAt(2) == ‘u’) {
advance();
advance();
advance();
hiragana += “\u3063”;
katakana += “\u30C3”;
}
} else if (currChar == ‘u’) {
hiragana += “\u3045”;
katakana += “\u30A5”;
advance();
longUCheck();
} else if (currChar == ‘w’) {
if (romaji.charAt(1) == ‘a’) {
advance();
advance();
hiragana += “\u308E”;
katakana += “\u30EE”;
}
} else if (currChar == ‘y’) {
advance();
forcedY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3041\u3042”;
katakana += “\u30A1\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3047\u3048”;
katakana += “\u30A7\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3043\u3044”;
katakana += “\u30A3\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3049\u3046”;
katakana += “\u30A9\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3045\u3046”;
katakana += “\u30A5\u30FC”;
advance();
} else {
hiragana += “\u304D\u3059”;
katakana += “\u30AD\u30B9″;
}
}

private void romajiY() {
advance();
if (currChar == ‘\”) {
hiragana += “\u3044”;
katakana += “\u30A4”;
advance();
forcedVowel();
} else if (currChar == ‘a’) {
hiragana += “\u3084”;
katakana += “\u30E4”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u3044\u3047”;
katakana += “\u30A4\u30A7”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3044\u3043”;
katakana += “\u30A4\u30A3”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u3088”;
katakana += “\u30E8”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u3086”;
katakana += “\u30E6”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiY();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3083\u3042”;
katakana += “\u30E3\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3044\u3047\u3048”;
katakana += “\u30A4\u30A7\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3044\u3043\u3044”;
katakana += “\u30A4\u30A3\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u3088\u3046”;
katakana += “\u30E8\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3086\u3045\u3046”;
katakana += “\u30E6\u30A5\u30FC”;
advance();
} else {
hiragana += “\u3044”;
katakana += “\u30A4″;
}
}

private void romajiZ() {
advance();
if (currChar == ‘\”) {
hiragana += “\u305A”;
katakana += “\u30BA”;
advance();
forcedVowel();
} else if (currChar == ‘a’) {
hiragana += “\u3056”;
katakana += “\u30B6”;
advance();
longACheck();
} else if (currChar == ‘e’) {
hiragana += “\u305C”;
katakana += “\u30BC”;
advance();
longECheck();
} else if (currChar == ‘i’) {
hiragana += “\u3058”;
katakana += “\u30B8”;
advance();
longICheck();
} else if (currChar == ‘o’) {
hiragana += “\u305E”;
katakana += “\u30BE”;
advance();
longOCheck();
} else if (currChar == ‘u’) {
hiragana += “\u305A”;
katakana += “\u30BA”;
advance();
longUCheck();
} else if (currChar == ‘y’) {
hiragana += “\u3058”;
katakana += “\u30B8”;
advance();
forcedY();
} else if (currChar == ‘z’) {
hiragana += “\u3063”;
katakana += “\u30C3”;
romajiZ();
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3056\u3042”;
katakana += “\u30B6\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u305C\u3048”;
katakana += “\u30BC\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3058\u3044”;
katakana += “\u30B8\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u305E\u3046”;
katakana += “\u30BE\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u305A\u3046”;
katakana += “\u30BA\u30FC”;
advance();
} else {
hiragana += “\u305A”;
katakana += “\u30BA”;
}
}

private void performConversion() {
// romaji = document.forms[0].romaji.value;
romaji = romaji.toLowerCase();
hiragana = “”;
katakana = “”;
// loop to convert the romaji
start();
while (romaji.length() > 0) {
if (currChar == ‘a’)
romajiA();
else if (currChar == ‘b’)
romajiB();
else if (currChar == ‘c’)
romajiC();
else if (currChar == ‘d’)
romajiD();
else if (currChar == ‘e’)
romajiE();
else if (currChar == ‘f’)
romajiF();
else if (currChar == ‘g’)
romajiG();
else if (currChar == ‘h’)
romajiH();
else if (currChar == ‘i’)
romajiI();
else if (currChar == ‘j’)
romajiJ();
else if (currChar == ‘k’)
romajiK();
else if (currChar == ‘l’)
romajiL();
else if (currChar == ‘m’)
romajiM();
else if (currChar == ‘n’)
romajiN();
else if (currChar == ‘o’)
romajiO();
else if (currChar == ‘p’)
romajiP();
else if (currChar == ‘q’)
romajiQ();
else if (currChar == ‘r’)
romajiR();
else if (currChar == ‘s’)
romajiS();
else if (currChar == ‘t’)
romajiT();
else if (currChar == ‘u’)
romajiU();
else if (currChar == ‘v’)
romajiV();
else if (currChar == ‘w’)
romajiW();
else if (currChar == ‘x’)
romajiX();
else if (currChar == ‘y’)
romajiY();
else if (currChar == ‘z’)
romajiZ();
else if (currChar == ‘-‘) {
hiragana += “\u30FC”;
katakana += “\u30FC”;
advance();
} else if (currChar == ‘,’) {
hiragana += “\u3001”;
katakana += “\u3001”;
advance();
} else if (currChar == ‘.’) {
hiragana += “\u3002”;
katakana += “\u3002”;
advance();
} else if (currChar == ‘\\’) {
advance();
if (currChar == ‘.’) {
hiragana += “.”;
katakana += “.”;
advance();
} else {
hiragana += currChar;
katakana += currChar;
}
}
// long a romaji
else if (currChar == ‘\u00E2’ || currChar == ‘\u0101’) {
hiragana += “\u3042\u3042”;
katakana += “\u30A2\u30FC”;
advance();
}
// long e romaji
else if (currChar == ‘\u00EA’ || currChar == ‘\u0113’) {
hiragana += “\u3048\u3048”;
katakana += “\u30A8\u30FC”;
advance();
}
// long i romaji
else if (currChar == ‘\u00EE’ || currChar == ‘\u012B’) {
hiragana += “\u3044\u3044”;
katakana += “\u30A4\u30FC”;
advance();
}
// long o romaji
else if (currChar == ‘\u00F4’ || currChar == ‘\u014D’) {
hiragana += “\u304A\u3046”;
katakana += “\u30AA\u30FC”;
advance();
}
// long u romaji
else if (currChar == ‘\u00FB’ || currChar == ‘\u016B’) {
hiragana += “\u3046\u3046”;
katakana += “\u30A6\u30FC”;
advance();
} else if (currChar == ‘ ‘) {
// ignore most spaces
advance();
} else {
hiragana += currChar;
katakana += currChar;
advance();
}
}

}

}

read more : https://github.com/tygonorg/japaneseHelper/blob/master/JapaneseHelper.java

Native Method example using JNI


Trivial JNI example

  1. Declare your native methods in an otherwise normal Java class.
    public class nativetest
    {
    	public native String sayHello(String s);
    	public static void main(String[] argv)
    	{
    		String retval = null;
    		nativetest nt = new nativetest();
    		retval = nt.sayHello("Beavis");
    		System.out.println("Invocation returned " + retval);
    	}
    }
    
  2. javac nativetest.java
    Standard Java compile
  3. javah -jni nativetest
    Generates .h files. Here is the code.
    /* DO NOT EDIT THIS FILE - it is machine generated */
    #include 
    /* Header for class nativetest */
    
    #ifndef _Included_nativetest
    #define _Included_nativetest
    #ifdef __cplusplus
    extern "C" {
    #endif
    /*
     * Class:     nativetest
     * Method:    sayHello
     * Signature: (Ljava/lang/String;)Ljava/lang/String;
     */
    JNIEXPORT jstring JNICALL Java_nativetest_sayHello
      (JNIEnv *, jobject, jstring);
    
    #ifdef __cplusplus
    }
    #endif
    #endif
    
  4. Write your native code, using the .h file generated above Copy the function prototype from the .h file and paste it in.
    #include "nativetest.h"	/*double quotes tells it to search current directory*/
    
    JNIEXPORT jstring JNICALL Java_nativetest_sayHello
      (JNIEnv *env, jobject thisobject, jstring js)
    
    {
    	return js;
    }
    
  5. Compile
    cl -c /Ic:\jdk1.1.6\include /Ic:\jdk1.1.6\include\win32 nativetest.c 
    link /libpath=c:\jdk1.1.6\lib nativetest.obj /dll
    

    The above uses Microsoft Visual C++ command-line tools.

  6. Modify your Java class to load the library.
    public class nativetest
    {
    	static {
    		System.loadLibrary("nativetest");
    	}
    	public native String sayHello(String s);
    	public static void main(String[] argv)
    	{
    		String retval = null;
    		nativetest nt = new nativetest();
    		retval = nt.sayHello("Beavis");
    		System.out.println("Invocation returned " + retval);
    	}
    }
    
  7. run the example
    C:\jni\hello>java nativetest
    Invocation returned Beavis
    

Source : http://patriot.net/~tvalesky/jninative.html

Giáo trình Java Sun – SSDG


Java là một công nghệ xây dựng các ứng dụng phần mềm có vị trí rất lớn trong những năm cuối thế kỉ 20, đầu thế kỉ 21. Nó được coi là công nghệ mang tính cách mạng và khả thi nhất trong việc tạo ra các ứng dụng có khả năng chạy thống nhất trên nhiều nền tảng mà chỉ cần biên dịch một lần.

java_sun

Lần đầu tiên xuất hiện vào năm 1992 như là một ngôn ngữ dùng trong nội bộ tập đoàn Sun Microsystems để xây dựng ứng dụng điều khiển các bộ xử lý bên trong máy điện thoại cầm tay, lò vi sóng, các thiết bị điện tử dân dụng khác. Không chỉ là một ngôn ngữ. Java còn là một nền tảng phát triển và triển khai ứng dụng trong đó máy ảo Java, bộ thông dịch có vai trò trung tâm.

PHẦN LÝ THUYẾT
Chương 1: Tổng quan về Java
Chương 2: Giới thiệu về ngôn ngữ Java
Chương 3: Đối tượng lớp và mảng
Chương 4: Package và Interface
Chương 5: Xây xựng Java Applet
Chương 6: Lập trình giao diện
Chương 7: Đối tượng đồ họa
Chương 8: Xử lý ảnh
Chương 9: Xử lý luồng và tập tin (IO Stream)
Chương 10: JavaBeans
Chương 11: RMI và kỹ thuật lập trình phân tán đối tượng trong Java
Chương 12: JSP
Chương 13: Servlet
Chương 14: Session – Cookies – Shopping Cart
Chương 15: JDBC
Chương 16: Tải file lên Web Server
Chương 17: Ứng dụng Web Mail
PHẦN BÀI TẬP (Hơn 200 bài)
Bài tập Java Cơ Bản
Bài tập về Applet
Bài tập về GUI
Bài tập về IOStream
Bài tập về Java Bean
PHẦN THƯ GIÃN

Download

http://www.mediafire.com/?1kn7dqo2isi72v8
http://www.mediafire.com/?y0n45svw3eiuw7z
http://www.mediafire.com/?75dn11q4bffqf7r
http://www.mediafire.com/?ua6gxd78ad728y9
http://www.mediafire.com/?pcd6p37o3y99hrb
http://www.mediafire.com/?2l292oxhu925rph

How to Earn Money By Developing ANDROID JAVA Applications


How to Earn Money By Developing ANDROID JAVA Applications?

In the world of competition between smartphones like Blackberry, iPhone and Droid, application developers have a huge potential to become rich in less time. Android is a software stack developed by GOOGLE for mobile devices that includes an operating system, middleware and key applications. It is easy to earn money by developing Android JAVA based applications by following techniques and guidance from this article.


ANDROID SDK SETUP:

Visit the development tools website for Android from the link given in references of this article. Assuming that you are using Windows operating system, download the Android SDK for Windows. Unpack the downloaded .zip file to a safe location. Add this location to the PATH variable by Right-clicking My Computer, Select properties, select Environment Variables under Advanced settings. Add the path location to the PATH variable by editing it.
Install SDK by running SDK Setup.exe from root directory of SDK tool.


ECLIPSE PLUG-IN SETUP:

Android offers a custom plug-in for the Eclipse IDE, called Android Development Tools (ADT). This provides a good advantage if you are also developing applications for Blackberry smartphone. This way you can develop applications in parallel for both the platforms, i.e. Blackberry and Android.
Install the Eclipse IDE 3.4 (Ganymede) from its website. Open Eclipse IDE and in the software updates, type the URL https://dl-ssl.google.com/android/eclipse/ and install the updates. Modify your Eclipse preferences to point to the Android SDK directory.

PROGRAMMING FUNDAMENTALS:

Android applications are written in the JAVA programming language. There are various APIs specifically written for Android which can be used for preparing applications specific to certain device running on Android platform. Once an application is successfully compiled, a .apk file is generated One apk file is one complete Android application.

TEST APPLICATION:

Once the Android Plug-in for Eclipse is installed successfully, restart Eclipse tool and start developing a Test application project.
Select File > New Project > Android Project
Enter a name for project. Select a Build Target 1.4, 1.5 or 1.6 and Enter Application Name, Package Name and Min SDK Version.
Click on “Finish”.
Copy the source code for a basic Hello World project from the link given in resources. Build project and Run on the Emulator.

SIGNING APPLICATIONS:

It is important to Sign an application before publishing it for security and integrity reasons. If you are using Eclipse tool and if ADT has proper access to the Keytool then there is no specific action required The application will be signed when it is compiled and debugged. To sign an application for public release, obtain a signature for public release and compile the application in Release mode by following procedure outlined on Android Developers website.

PUBLISHING APPLICATIONS:

It is important to Test your application before releasing on an actual device rather than just the Emulator. You will have to purchase either an Android running phone like Motorola Droid or an Android Development phone. Add an End User license agreement and publish on Android Market.

EARNING REVENUE FROM APPLICATIONS:

The most important reason for application development is to earn money. You will need to pay a one time registration fee of $25 to become an Android developer and publish applications. Once your application is published on Android Market and people all over the world start downloading the application at your published price, you will receive 70% of the revenue while Google will keep 30% of it. For example, an application worth $1 downloaded by 1000 people will earn you 70% of that which is $700. If you develop a very good quality application, you can earn prize money of $150,000 or 100,000 or 50,000 or 25,000 based on overall ratings given by users through Android ADC2 challenge.

How-to-Earn-Money-By-Developing-ANDROID-JAVA-Applications1

Start up by opening your emulator. Go to File > New > Project > Android and fill in the project details. we called my project Hello World, with the package name of com.oxavi.hello, an activity name of HelloWorld, and application name of HelloWorld The package name has to follow the same naming convention as Java packages. This is what it looked like right after we made the project.

How-to-Earn-Money-By-Developing-ANDROID-JAVA-Applications2

Go to appinventor.googlelabs.com Click on MyProjects link on RHS. we assuming that your google user Id has

permissions to use app inventor you will also need to accept the T&C(first time) You will see window like below.
Drag a textbox, button and label as shown below. You can click on Properties on RHS to change button/label text.
If you need to delete something then you may use the delete button below components column. You may note that
if you change labels then it may not immediately get refreshed. After making changes click on “Save” button on top.
Now click on Open blocks editor button on top and download/accept any JNLP permissions to start it.

Web

The new operating system developed by Google, Android, has been flooding many phone’s system and mobile devices. Today, Android has become a major platform for application developers.  Besides the operating system, Android also includes middleware and some key applications.

Also, there is Android Software Development Kit that offers tools and APIs necessary. With Android SDK, developers are able to begin the development of application on the Android platform by using Java programming language.

the sources:

http://spiritsoft.net

http://android-java.blogspot.com

http://www.oxavi.com

Source : http://4android-phone.com/how-to-earn-money-by-developing-android-java-applications/