Example usage for java.lang String copyValueOf

List of usage examples for java.lang String copyValueOf

Introduction

In this page you can find the example usage for java.lang String copyValueOf.

Prototype

public static String copyValueOf(char data[]) 

Source Link

Document

Equivalent to #valueOf(char[]) .

Usage

From source file:Main.java

public static void main(String[] argv) {
    char[] chars = new char[] { 'j', 'a', 'v', 'a', '2', 's', '.', 'c', 'o', 'm' };

    System.out.println(String.copyValueOf(chars));
}

From source file:MainClass.java

public static void main(String[] arg) {
    char[] textArray = { 'T', 'o', ' ', 'b', 'e', ' ', 'o', 'r', ' ', 'n', 'o', 't', ' ', 't', 'o', ' ', 'b',
            'e' };

    String text = String.copyValueOf(textArray);

    System.out.println(text);/*from   w  w  w  .  ja va  2  s  .  c  o  m*/
}

From source file:Main.java

public static Map<String, List<String>> createDictionary(Context context) {
    try {/*from  ww w .java 2  s. c  om*/
        AssetManager am = context.getAssets();
        InputStream is = am.open(DICTIONARY_FILENAME);
        Scanner reader = new Scanner(is);
        Map<String, List<String>> map = new HashMap<String, List<String>>();

        while (reader.hasNextLine()) {
            String word = reader.nextLine();
            char[] keyArr = word.toCharArray();
            Arrays.sort(keyArr);
            String key = String.copyValueOf(keyArr);

            List<String> wordList = map.get(key);
            if (wordList == null) {
                wordList = new LinkedList<String>();
            }
            wordList.add(word);
            map.put(key, wordList);
        }
        reader.close();
        return map;
    } catch (Exception e) {
        System.out.println(e.getMessage());
        e.printStackTrace();
    }
    return null;
}

From source file:io.sidecar.security.SecurityUtils.java

/**
 * Generates a String representation of an MD5 Checksum from a given String input.
 *
 * @param input - A non-null String.//from w  w  w. j a v a 2  s.  com
 * @return an MD5 checksum as a Hex encoded String.
 */
public static String md5(String input) {
    checkNotNull(input);
    try {
        //Create MessageDigest object for MD5
        MessageDigest digest = MessageDigest.getInstance(MD5_ALGORITHM);

        //Update input string in message digest
        digest.update(input.getBytes(), 0, input.length());

        //Converts message digest value in base 16 (hex)
        return String.copyValueOf(Hex.encodeHex(digest.digest()));
    } catch (NoSuchAlgorithmException e) {
        throw new IllegalStateException(e);
    }
}

From source file:mitm.common.util.HexUtils.java

public static String hexEncode(byte[] data, String defaultIfNull) {
    if (data == null) {
        return defaultIfNull;
    }/*from  w w w .  ja  va2 s.  c  o m*/

    return String.copyValueOf(Hex.encodeHex(data)).toUpperCase();
}

From source file:Controlador.ChartServlet.java

public JFreeChart getChart() throws URISyntaxException {

    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    Equipos eq = new Equipos();
    Equipo e = eq.buscar(1);/*from w  w w  .  j  a v  a  2s. c om*/
    dataset.addValue(e.getNumSerie(), String.copyValueOf(e.getNombre()), " 1");

    JFreeChart chart = ChartFactory.createBarChart3D("3D Bar Chart Demo", // chart title
            "equipo", // domain axis label
            "Value", // range axis label
            dataset, // data
            PlotOrientation.VERTICAL, // orientation
            true, // include legend
            true, // tooltips
            false // urls
    );

    CategoryPlot plot = chart.getCategoryPlot();
    CategoryAxis axis = plot.getDomainAxis();
    axis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 8.0));

    CategoryItemRenderer renderer = plot.getRenderer();
    renderer.setItemLabelsVisible(true);
    BarRenderer r = (BarRenderer) renderer;
    r.setMaximumBarWidth(0.05);
    return chart;

}

From source file:MainProgram.MainProgram.java

public static void registrationMain(String courseNumber) throws InterruptedException, IOException {
    System.out.println("Web driver starts...");
    String passwordString = String.copyValueOf(MainFrameProgram.pennPassField.getPassword());
    int semesterNum = Integer.parseInt(MainFrameProgram.semesterComboBox.getSelectedItem().toString());
    WebDriver_Registration.courseRegistration(MainFrameProgram.pennIDTextField.getText(), passwordString,
            courseNumber, semesterNum, MainFrameProgram.dropCheckBox.isSelected());
    Scanner sc = new Scanner(System.in);
    int i = sc.nextInt();

}

From source file:com.orm.androrm.field.CharField.java

public void set(char[] chars) {
    this.set(String.copyValueOf(chars));
}

From source file:com.ge.apm.web.WeChatCoreController.java

/**
 * ?webservice??????//from ww  w  .  j  av  a2s  .  c  o m
 *
 * @param request
 * @param response
 * @throws Exception
 */
@RequestMapping(value = "core")
public void wechatCore(HttpServletRequest request, HttpServletResponse response) throws Exception {
    response.setContentType("text/html;charset=utf-8");
    response.setStatus(HttpServletResponse.SC_OK);

    String signature = request.getParameter("signature");
    String nonce = request.getParameter("nonce");
    String timestamp = request.getParameter("timestamp");

    if (!this.wxMpService.checkSignature(timestamp, nonce, signature)) {
        // ?????????
        response.getWriter().println("?");
        return;
    }

    String echoStr = request.getParameter("echostr");
    if (StringUtils.isNotBlank(echoStr)) {
        // ??echostr
        String echoStrOut = String.copyValueOf(echoStr.toCharArray());
        response.getWriter().println(echoStrOut);
        return;
    }
    System.out.println("current token is \n" + wxMpService.getAccessToken());
    String apiTicket = wxMpService.getJsapiTicket();
    System.out.println("current apiTicket is \n" + apiTicket);
    String encryptType = StringUtils.isBlank(request.getParameter("encrypt_type")) ? "raw"
            : request.getParameter("encrypt_type");

    if ("raw".equals(encryptType)) {
        // ?
        WxMpXmlMessage inMessage = WxMpXmlMessage.fromXml(request.getInputStream());
        WxMpXmlOutMessage outMessage = this.coreService.route(inMessage);
        response.getWriter().write(outMessage == null ? "" : outMessage.toXml());
        return;
    }

    if ("aes".equals(encryptType)) {
        // aes?
        String msgSignature = request.getParameter("msg_signature");
        WxMpXmlMessage inMessage = WxMpXmlMessage.fromEncryptedXml(request.getInputStream(), this.configStorage,
                timestamp, nonce, msgSignature);
        WxMpXmlOutMessage outMessage = this.coreService.route(inMessage);
        response.getWriter().write(outMessage == null ? "" : outMessage.toEncryptedXml(this.configStorage));
        return;
    }

    response.getWriter().println("??");
    return;
}

From source file:de.longri.cachebox3.Utils.java

public static String decrypt(String value) {
    int[] b = null;
    try {//from  w  ww  .jav  a2 s.  co  m
        b = byte2intArray(Base64.decode(value));
    } catch (IOException e) {

        e.printStackTrace();
    }

    RC4(b, Key);
    String decrypted = "";

    char[] c = new char[b.length];
    for (int x = 0; x < b.length; x++) {
        c[x] = (char) b[x];
    }

    decrypted = String.copyValueOf(c);

    return decrypted;

}