Here you can find the source of getBytes(String defaultPlain)
public static byte[] getBytes(String defaultPlain)
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { public static byte[] getBytes(String defaultPlain) { byte[] data = null; while (true) { System.out.print("Please Input Data \"" + defaultPlain + "\"(default): "); try { String str = new BufferedReader(new InputStreamReader(System.in)).readLine(); if ("".equals(str)) { data = defaultPlain.getBytes(); } else { data = str.getBytes(); }/*from w ww . j av a 2 s. c o m*/ break; } catch (Exception e) { data = defaultPlain.getBytes(); } } return data; } }