id stringlengths 20 22 | content stringlengths 46 417 |
|---|---|
aixbench-auto_data_1 | Take a collection of Strings and return a combined string as a comma separated list with 'and' between the final pair. For example: [a, b, c] to "a, b and c".
public static String collectionToCommaDelimitedString(List<String> coll) |
aixbench-auto_data_2 | Creates a padding string of a certain length
public static String createPadding(int length, char padChar) |
aixbench-auto_data_3 | Create and returns a HttpURLConnection connection to a webpage
public static HttpURLConnection createHttpConnection(URL url, int connectTimeout, Map<String, String> requestProperties) |
aixbench-auto_data_4 | Write content to the file. If file does not exist, it will create one.
public static void writeToFile(String content, String fileName) |
aixbench-auto_data_5 | Close Reader. If object is null it is ignored
public static void close(Reader reader) |
aixbench-auto_data_6 | max() that works on three integers
public static float max(float a, float b, float c) |
aixbench-auto_data_7 | put a short value into a byte array with specific offset
public static void putShort(byte[] data, short value, int offset) |
aixbench-auto_data_8 | 从 http 服务拉取配置文件并解析为Properties 对象
public Properties getProperties(String url) |
aixbench-auto_data_9 | 给一个数组,找出最大值并且返回。
public static int findMaxNumber(int[] nums) |
aixbench-auto_data_10 | 将 Date 类型转为时间字符串,格式为 format
public static String date2String(final Date date, final DateFormat format) |
aixbench-auto_data_11 | Looks through the backups directory and assembles a list of all json backup files found.
public static List<String> getBackupFiles(String dir) |
aixbench-auto_data_12 | Rearranges the elements of the specified subarray in random order.
public static void shuffle(int[] array) |
aixbench-auto_data_13 | Retrieves the value by specified int index of the given List.
public static String getValue(List<String> list, int index) |
aixbench-auto_data_14 | Returns a string, consisting of given length random char from given alphabet.
public static String randomString(int length, String alphabet) |
aixbench-auto_data_15 | 用1到n随机初始化二维数组
public static void init(int[][] arr, int n) |
aixbench-auto_data_16 | Copy a file from source path to destination path
public static void copyFile(String sourcePath, String destPath) |
aixbench-auto_data_17 | Get a hashCode for the real vector. All NaN values have the same hash code.
public static int hashCode(double[] vector) |
aixbench-auto_data_18 | Parses character set name to Charset object
public static Charset charsetForName(String charsetName) |
aixbench-auto_data_19 | Reads up to len bytes of data from this input stream into an array of bytes
public static byte[] readBytes(java.io.InputStream in, int len) |
aixbench-auto_data_20 | Parses query string to Map from an url.
public static Map<String, String> parseQueryString(String queryString) |
aixbench-auto_data_21 | Returns the value of an array by index, or null if the array has no value at that index.
public static Object get(Object[] array, int index) |
aixbench-auto_data_22 | Set the additional (undeclared) property with the specified name and value. If the property does not already exist, create it otherwise replace it.
public static void putAdditionalProperty(String key, Object value, Map<String, Object> additionalProperties) |
aixbench-auto_data_23 | Read the base64 encoded image data from a JPEG image.
public static String readImageData(String filename) |
aixbench-auto_data_24 | Returns the distance for the two given point
public static float distance(float x0, float y0, float x1, float y1) |
aixbench-auto_data_25 | Writes a collection of Strings to a File, overwriting any previous file contents. Each String is converted into a line in the File.
public static void writeFile(Collection<String> lines, File file) |
aixbench-auto_data_26 | Generate a hex string for the specified bytes.
public static String toHex(byte[] byteArr) |
aixbench-auto_data_27 | 获取相应文件filepath的input stream
public static java.io.InputStream getInputStream(String filepath) |
aixbench-auto_data_28 | 获取类上具有指定注解的接口的名称,如果有多个,则以第一个为准 找不到符合条件的接口则返回 clazz 类的名称
public static String getInterfaceName(Class<?> clazz, Class<? extends Annotation> annotation) |
aixbench-auto_data_29 | Split the given sequence with the given delimiter and return list of values.
public static java.util.List<String> split(String sequence, String delimiter) |
aixbench-auto_data_30 | This returns the euclidean distance of two vectors sum(i=1,n) (q_i - p_i)^2
public static double euclideanDistance(double[] p, double[] q) |
aixbench-auto_data_31 | Returns the entry associated with the specified key in map.
public static <K,V> Map.Entry<K, V> getEntry(Map<K,V> map, K key) |
aixbench-auto_data_32 | Returns the index of the first occurrence of the specified element in this list, returns -1 if the element is not found
public int indexOf(int[] array, int element) |
aixbench-auto_data_33 | Returns the minimum value in an array.
public static int min(int[] array) |
aixbench-auto_data_34 | Returns the sum of logarithms, which is Sum( Log(x[i]) ).
public double logSum(double[] x) |
aixbench-auto_data_35 | Do a simple bubble sort to sort the server ids in ascending order.
public static void sortServers(int[] serverIds) |
aixbench-auto_data_36 | Ensure that an object reference passed as a parameter to the calling method is not null.
public static void ensureNotNull(Object obj) |
aixbench-auto_data_37 | Extract the filename from the given path.
public static String extractFileName(String path) |
aixbench-auto_data_38 | Fill 1D matrix with random numbers.
public static void fillMatrix_1D(double[] m) |
aixbench-auto_data_39 | Find the occurence of the given key in the given array. Linear search, worst case running time is O(n).
public static int linearSearch(int[] arr, int key) |
aixbench-auto_data_40 | Generate a not existing temporary file in specified dir.
public static String generateTempFile(String dir) |
aixbench-auto_data_41 | Get one character of index i from a given string buffer.
public static char getChar(StringBuffer sb, int i) |
aixbench-auto_data_42 | 将map中所有的key转为大写
public static Map<String, Object> getAllUpperCase(Map<String, Object> map) |
aixbench-auto_data_43 | 得到距离当前时间前一年的时间 @Title: getLastYearDate
public static String getLastYearDate() |
aixbench-auto_data_44 | 更新url中的参数(保证参数不重复)
public static String updateUrl(String url, String key, String value) |
aixbench-auto_data_45 | 移除 map 中的 null 或者 空字符串
public static void removeNullValue(Map<String, Object> map) |
aixbench-auto_data_46 | 获取某个时间data的年份
public static int getYear(Date date) |
aixbench-auto_data_47 | Element-by-element matrix multiplication in place, A = A*B
public void matrixMultiply(double[][] A, double[][] B) |
aixbench-auto_data_48 | 通过反射获取某个类的对象内所有的 public 成员变量, 包括该类的基类
public static List<Field> getFields(Class<?> clazz) |
aixbench-auto_data_49 | Adds all of the elements in collection to the Set.
public static void addAll(Set<Integer> set, Collection<Integer> collection) |
aixbench-auto_data_50 | Helper function to convert a long number into a byte array (least significant byte first).
public static byte[] longToBytes(long x) |
aixbench-auto_data_51 | 将byte数组转化为16进制字符串
public static String bytesToHexString(byte[] src) |
aixbench-auto_data_52 | Returns a hash code value for this bit array.
public static int hashCode(byte[] byteArr) |
aixbench-auto_data_53 | Removes the entry with the specified key from this map if present.
public static void remove(Map<Integer, String> mapObj, Integer key) |
aixbench-auto_data_54 | Convert a primitive input array into its object array version (e.g. from int[] to Integer[]).
public static Integer[] toObjectArray(int[] array) |
aixbench-auto_data_55 | 判断字符串是否只含字母和数字
public static boolean isLetterOrDigit(String str) |
aixbench-auto_data_56 | 判断是否只含字母
public static boolean isLetter(char c) |
aixbench-auto_data_57 | Join 2 path elements if path separator not present at the end of first path element,else return the first element.
public static String joinPath(String path1, String path2) |
aixbench-auto_data_58 | Converts an int into an array of byte using the default (little endian, Lsb0) byte and bit ordering.
public static byte[] intToByteArray(int value) |
aixbench-auto_data_59 | convert byte array to a hex string
public String bytesToHex(byte[] bytes) |
aixbench-auto_data_60 | Calculates combinatorial number C(n,m).
public static int combinatorial(int n, int m) |
aixbench-auto_data_61 | 检验用户名是否合法,只能包括a-z,A-Z,0-9和下划线_,不能以下划线结尾 用户名有最小长度和最大长度限制,比如用户名必须是4-20位
public static boolean checkUsername(String username) |
aixbench-auto_data_62 | 得到现在时间
public static String getStringToday(String format) |
aixbench-auto_data_63 | return the last day of the date's month of specified string value in format: yyyy-MM
public static Date getMonthLastDay(String dateString) |
aixbench-auto_data_64 | Merges the given two lists to a new list, but eliminating duplicates elements.
public static <T> ArrayList<T> merge(ArrayList<T> list1, ArrayList<T> list2) |
aixbench-auto_data_65 | Multiplies the vector by the transpose of the given matrix.
public static double[] multiplyTranspose(double[] vector, double[][] matrix) |
aixbench-auto_data_66 | Removes and returns last element in list, return null if empty.
public static String removeLast(ArrayList<String> list) |
aixbench-auto_data_67 | Returns the largest value in linked list.
public static int getMax(LinkedList<Integer> list) |
aixbench-auto_data_68 | Calculate the elapsed time between two times specified in milliseconds.
public static long elapsedTime(Calendar start, Calendar end) |
aixbench-auto_data_69 | Compute the CRC32 of an array of bytes.
public static long crc32(byte[] bytes) |
aixbench-auto_data_70 | Create an instance of a clazz using the current thread context ClassLoader.
public static <T> T newInstance(Class<T> clazz) |
aixbench-auto_data_71 | Delete data from start until end index (end inclusive) of a object List.
public static <T> void delete(List<T> list, int start, int end) |
aixbench-auto_data_72 | Get the number of days for the given month in the given year.
public static int getDaysInMonth(int year, int month) |
aixbench-auto_data_73 | 得到filepath路径下第一层目录结构中所有的class文件
public static List<String> getClassFileNames(String filepath) |
aixbench-auto_data_74 | 用str2替换字符串str中第一个出现的str1
public static String replaceFirst(String str, String str1, String str2) |
aixbench-auto_data_75 | Writes certain bytes from the specified byte array starting from an offset to this output stream.
public static void write(byte[] b, int off, int len, OutputStream outputStream) |
aixbench-auto_data_76 | 随机生成[origin, bound)范围之内的一个int值
public static int randomInt(int origin, int bound) |
aixbench-auto_data_77 | 上传一个文件filename至指定路径pathname下
public static void uploadFile(String pathname, String filename) |
aixbench-auto_data_78 | Debug helper function that returns the diff of two property maps, only displaying the key that is different and in which map it exists compared to the other map,example:map:key1,key2 map2:key1,key2,key3
public static String diff(java.util.Map<String, String> map1, java.util.Map<String, String> map2) |
aixbench-auto_data_79 | Returns a new, immutable collection containing the names of all entities within the directory denoted by the current path
public static List<String> getFiles(String dir) |
aixbench-auto_data_80 | Rotate this a two-dimensional point around Y axis with the given angle in radians.
public static Point rotateY(double angle, Point point) |
aixbench-auto_data_81 | If the string passed in is not blank or null and did not end with the trailing value, then appended the trailing value to it and return the result
public static String appendTrailing(String str, String trailing) |
aixbench-auto_data_82 | Returns true if the collection contains an element for the key.
public static boolean containsKey(Collection<String> collection, String key) |
aixbench-auto_data_83 | Returns true if the given object is an instance of the class or interface specified.
public static boolean isInstanceOf(Object object, Class<?> type) |
aixbench-auto_data_84 | 将16进制字符串转10进制
public static int hexStringToInt(String hexString) |
aixbench-auto_data_85 | Add two integers, checking for overflow.
public static boolean checkOverflow(int x, int y) |
aixbench-auto_data_86 | Add the value to the HashSet given by map.get(key), creating a new HashSet if the HashSet is null
public static void addToSet(Map<String, HashSet<Integer>> map, String key, Integer value) |
aixbench-auto_data_87 | Calculate and return the average of the two values rounded DOWN.
public static int average(int a, int b) |
aixbench-auto_data_88 | Check if #MIN_VALUE <= value <= #MAX_VALUE and if not an IllegalArgumentException is thrown.
public static void checkRange(int value, int min, int max) |
aixbench-auto_data_89 | Check whether the String is a valid Java number
public static boolean isNumber(String str) |
aixbench-auto_data_90 | Choose a pseudo-random element from the specified array.
public static int random(int[] array) |
aixbench-auto_data_91 | Compare two java objects for equality.
public static boolean equals(Object o1, Object o2) |
aixbench-auto_data_92 | Compute the product of this matrix and the given column vector.
public static double[] product(double[] columnVector,double[][] matrix) |
aixbench-auto_data_93 | Concatenate two arrays of T type
public static <T> T[] concat(T[] a, T[] b) |
aixbench-auto_data_94 | Convert the text '&' mnemonic string to text string. The '&' symbol is treated as the mnemonic pointer. The double "&&" symbols are treated as the single '&'. For example the string "&Look && Feel" is converted to "Look & Feel".
public static String convertMnemonicString(String text) |
aixbench-auto_data_95 | Convert a boolean value into a string.
public static String boolToString(boolean b) |
aixbench-auto_data_96 | Convert an arbitrary text encoding to its canonical name.
public static String canonicalEncodingName(String encoding) |
aixbench-auto_data_97 | Create a copy of the Integer array.
public static int[] copy(int[] arr) |
aixbench-auto_data_98 | Returns the current number of entries in the map.
public static int size(Map<String, String> map) |
aixbench-auto_data_99 | Returns true if two doubles are considered equal. Tests if the absolute difference between the two doubles has a difference less then a given double (epsilon)Returns true if two doubles are considered equal. Tests if the absolute difference between the two doubles has a difference less then a given double (epsilon)
pu... |
aixbench-auto_data_100 | Puts a byte and a short into this byte vector. The byte vector is automatically enlarged if necessary.
public static void putShort(byte[] data, byte b, short s) |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4