Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    protected final static int HIGHEST_ENCODABLE_TEXT_CHAR = '>';

    protected static boolean needCData(String value) {
        final int length = value.length();
        for (int i = 0; i < length; i++) {
            final char c = value.charAt(i);
            if (c <= HIGHEST_ENCODABLE_TEXT_CHAR) {
                if (c <= 0x001f) {
                    if (c != '\n' && c != '\t' && c != '\r') { // fine as is
                        return true;
                    }
                } else if (c == '<' || c == '&') {
                    return true;
                }
            }
        }
        return false;
    }
}