1. public int[] copyEvens(int[] nums, int count) {
  2.  
  3. int newIndex=0;
  4. int i=0;
  5. int newArray[] = new int[count];
  6. while(newIndex < count ){
  7. if( ( nums[i] % 2) ==0 ) newArray[newIndex++]=nums[i];
  8.  
  9. i++;
  10. }
  11.  
  12. return newArray;
  13.  
  14. }

http://codingbat.com/prob/p134174

copyEvens的更多相关文章

随机推荐

  1. 1、HDFS分布式文件系统

    1.HDFS分布式文件系统 分布式存储 分布式计算 2.hadoop hadoop含有四个模块,分别是 common. hdfs和yarn. common 公共模块. HDFS hadoop dist ...

  2. linux上传、下载文件rz、sz命令

    1.介绍 sz命令是利用ZModem协议来从linux服务器传送文件到本地,一次可以传送一个或多个文件.相对应的从本地上传文件到Linux服务器,可以使用rz命令. 2.参数说明 -a,以文本方式传输 ...

  3. Bonita portal 源码编译(未完成)

    首先下载源代码 https://github.com/bonitasoft/bonita-portal-js 以下内容为Github 的安装教程包含我安装过程中遇到的问题.并加以修正 Bonita p ...

  4. cs231n 17-18 assignment2 出现 No module named 'past' 解决方法

    解决方法: pip install future

  5. Selenium入门6 操作元素,获取元素属性

    取元素的text,属性get_attribute,标签名tag_name 操作元素:send_keys输入,click点击,submit提交,clear清除输入 状态判断:is_display,is_ ...

  6. caffe RandomOrderChannels

    就是将rgb图的3个channel随机打乱顺序,给定一个概率值是否执行这个操作,v系列模型的概率一般都设置的为0 void RandomOrderChannels(const cv::Mat& ...

  7. caffe RandomBrightness和RandomContrast

    1. void RandomBrightness(const cv::Mat& in_img, cv::Mat* out_img, const float brightness_prob, c ...

  8. django.template.exceptions.TemplateSyntaxError: 'article_tags' is not a registered tag library.

    django.template.exceptions.TemplateSyntaxError: 'article_tags' is not a registered tag library. Must ...

  9. 解决nsis error!cant initialize plug-ins directory.please try again later

    情况1: 调用SectionEnd会释放掉dll初始化标记,所有Section都必须放在函数的最下面. 情况2: 有可能是栈里的数据错乱,特别注意的是,使用BgWorker.dll获取多线程能力的时候 ...

  10. Wuss Weapp 一款高质量,组件齐全,高自定义的微信小程序 UI 组件库

    Wuss Weapp 一款高质量,组件齐全,高自定义的微信小程序 UI 组件库 文档 https://phonycode.github.io/wuss-weapp 扫码体验 使用微信扫一扫体验小程序组 ...